Lucy de Boer
 

Retrieve pageurl in SPSiteDataQuery

02

Jun

According to the web, using <FieldRef Name=\"EncodedAbsUrl\"/> is the way to retrieve the item url when using SPSiteDataQuery. However, for me (and others) this doesn't seem to work, only returning the root site url.
<FieldRef Name=\"ServerUrl\"/> appeared to be even more useless always returning only "/".
Appearantly this has something to do with the scope being used with SPSiteDataQuery.

However, you can still use <FieldRef Name=\"FileRef\"/>.
This will return a value like 7:#News/Pages/yourpage.aspx, and the last part is always server relative so useful enough. just chuck out what you don't need and make a url:

dr["EncodedAbsUrl"].ToString() + (new SPFieldLookupValue(dr["FileRef"] as string).LookupValue); }

---- edited to lookupvalue thanks to Keiths tip, thanks Keith ----

Share:

Lucy de Boer schreef

Comments (2)

Lucy de Boer

Keith Dahlby

07-06-2009 05:06

Since FileRef is implemented as a standard lookup, I would suggest leveraging SPFieldLookupValue:

var url = new SPFieldLookupValue(dr["FileRef"] as string).LookupValue;
Cheers ~
Keith

ravikanth

14-07-2009 11:14

Hi Lucy,

Have seen ur blog to assign task to Group
------------------------------------------------
SPGroup group = SPWeb.UserGroups[“groupname”];
SPFieldUserValue groupvalue = new SPFIeldUserValue( group.ParentWeb, group.ID, group.Name);
SPWorkflowTaskProperties taskProperties = new SPWorkflowTaskProperties();
(Connect these taskproperties to the task to update)

taskProperties.AssignedTo = groupvalue.LookupValue;

------------------------------------------------------
But i am not getting the property "SPWeb.UserGroups".. How to get it?? I am using VS 2008... please mail me the details... ravikanthk@intelligroup.com


Thanks in Advance,
Ravikanth Gore

Comments are closed.

Zoeken

Categorie

Archief


Sign In