Wierd CAML query item retrieved....
I am trying to retrieve announcement titles and the creator of those announcements. I am currently retrieving the announcement titles correctly. However when I am retrieving the 'Author' of announcement I get a wierd response back from the server.
<Query>
<Where>
<And>
<IsNotNull>
<FieldRef Name='Title'>
</IsNotNull>
<IsNotNull>
<FieldRef Name='Author'>
</IsNotNull>
</And>
<Where>
<OrderBy>
<FieldRef Name='Title' Ascending='true' />
<FieldRef Name='Author' Ascending='true' />
<OrderBy>
</Query>
This Retrieves:
Title: Get Started With Microsoft SharePoint Foundation!
Created By: Microsoft.SharePoint.Client.FieldUserValue
I will try and get the code up by today, but i am using the ClientContext object model in order to retrieve list data from sharepoint.
June 29th, 2012 11:39am
Hi afire007,
Thank you for your question.
I am trying to involve someone familiar with this topic to further look at this issue.
Thanks,
Lhan Han
Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2012 2:29am
thank you for the help. I have actually managed to get much farther in my project since this post. I have pretty much created a fully functional client side web application that can retrieve core items and document files based on the user that
has logged in.
I still seem to have an issue with this though. All of the announcements made seem to have Microsoft.SharePoint.Client.FieldUserValue
July 10th, 2012 8:29am
Hi,
The object that you get
FieldUserValue contains a property "LookupValue" that could be used get a description of the user that
the value of a lookup field for a list item is referring to.
Try using the following stub to retrieve information of the Author of the announcement:
objFieldUserValue.LookupValue.ToString();
Also check the following link for example/reference:
http://www.c-sharpcorner.com/uploadfile/anavijai/get-the-spfielduservaluecollection-values-using-client-object-model-in-sharepoint-2010/
Hope this helps!
Regards,
Devang Bhavsar
Free Windows Admin Tool Kit Click here and download it now
July 10th, 2012 10:13am
I believe this should do it:
ClientContext clientContext =
new ClientContext(siteUri);
List userList = clientContext.Web.SiteUserInfoList;
ListItem userItem = userList.GetItemById(user.LookupId);
clientContext.Load(userItem, item => item["Name"]);
clientContext.ExecuteQuery();
string userName = userItem["Name"]
as string;
Hope it helps,
July 12th, 2012 7:23pm