Articles about European Sharepoint Hosting Service
SharePoint 2013 Hosting – HostForLIFE.eu :: How to Check Logged in User is belong to any Type in SharePoint?
In this tutorial, i will explain you how to List items where Logged In user has Created List item / Modified List Item / It belong to custom list column. In SharePoint List each column is having internal name. some time column name & its internal name is different.
Created By column – internal name -> Author.
Modified By column – Internal Name -> Editor.
ContactDetails list contains column “AllUser” type -> Person or Group (Allow Multiple Selection = true).
This following code will fetch list records where current user has created list items or modified list items or it belong to “AllUser” group.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
List oList = clientContext.Web.Lists.GetByTitle("ContactDetails"); CamlQuery camlQuery = CamlQuery.CreateAllItemsQuery(); string UserTilte = "Rupali Shinde"; string QueryStr = ""; //Created By - Internal Name -> Author //Modified By - Internal Name -> Editor //Check loggedIn User is belog to any of 3 type - Author/Editor/AllUser(user defined column). QueryStr = @"<View>" + "<Query>" + "<Where>"+ "<Or>" + "<Eq>" + "<FieldRef Name='Author'/>" + "<Value Type='User'>" + UserTilte + "</Value>" + "</Eq>"+ "<Or> " + "<Contains>" + "<FieldRef Name='AllUser'/>" + "<Value Type='UserMulti'>" + UserTilte + "</Value>" + "</Contains>" + "<Eq>" + "<FieldRef Name='Editor'/>" + "<Value Type='User'>" + UserTilte + "</Value>" + "</Eq>"+ "</Or>" + "</Or>" + "</Where>" + "</Query>" + "</View>"; camlQuery.ViewXml = string.Format(QueryStr); Microsoft.SharePoint.Client.ListItemCollection collListItem = oList.GetItems(camlQuery); clientContext.Load(collListItem); clientContext.ExecuteQuery(); int itemcount = collListItem.Count; |
SharePoint 2013 Hosting Recommendation
HostForLIFE.eu’s SharePoint 2013 Hosting solution offers a comprehensive feature set that is easy-to-use for new users, yet powerful enough for the most demanding web developer expert. Hosted SharePoint Foundation 2013 is the premiere web-based collaboration and productivity enhancement tool on the market today. With SharePoint 2013 Foundation, you can quickly access and manage documents and information anytime, anywhere though a Web browser in a secure and user friendly way. SharePoint hosting services start at only at €9.99/mo, allowing you to take advantage of the robust feature set for a small business price. HostForLIFE.eu offers a variety of hosted SharePoint Foundation 2013 plans as well as dedicated SharePoint 2013 Foundation options.
Print article | This entry was posted by Peter on September 22, 2016 at 5:05 am, and is filed under European SharePoint 2013 Hosting. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |