caml
2 TopicsCAML query to filter List items on the basis of Current User group in sharepoint
I have List library which having column Name-Vendor, also I have differ sharepoint user groups for each vendor. I am using CAML query to filter List items, so user can see list items belong to its vendor group only. I am filtering List items using CAML query where value of currentuser group will be same as Value in Column of list items-Vendor I am using following CAML query, is this correct, I am not getting expected filter result. <Where><Eq><FieldRef Name="User_ID"/><Value Type="Text">911</Value></Eq><Membership Type="CurrentUserGroups"><FieldRef Name='Vendor' /></Membership></Where>Solved6.2KViews0likes2CommentsUsing CAML queries in SPFx or SharePoint PnP
I am attempting to recreate a webpart I made for SharePoint classic as a SharePoint modern webpart. I need to use a CAML query to get the one person who is on-call in our department (kept in a SharePoint calendar). I can only find very simple query examples but I need to use a complex CAML query. 1) can someone show me where to find documentation on what I am trying to do 2) can someone tell me what I am doing wrong in this code. private getOnCall(): void { const context: SP.ClientContext = new SP.ClientContext(this.properties.siteUrl); const list: SP.List = context.get_web().get_lists().getByTitle('On Call'); context.loadQuery(list, '<View><ViewFields><FieldRef Name="Title" /><FieldRef Name="EventDate" /><FieldRef Name="EndDate" /></ViewFields><Query><Where>' + '<And><Contains><FieldRef Name="Title" /><Value Type="Text">On-Call</Value></Contains><And><Leq><FieldRef Name="EventDate" /><Value IncludeTimeValue="True" Type="DateTime">' + '<Today /></Value></Leq><Geq><FieldRef Name="EndDate" /><Value IncludeTimeValue="True" Type="DateTime"><Today /></Value></Geq></And></And></Where></Query></View>'); context.executeQueryAsync((sender: any, args: SP.ClientRequestSucceededEventArgs): void => { const listEnumerator: IEnumerator<SP.ListItem> = list.getEnumerator(); var title: string; while (listEnumerator.moveNext()) { const item: SP.ListItem = listEnumerator.get_current(); title = item.get_item('Title'); } }, (sender: any, args: SP.ClientRequestFailedEventArgs): void => { } }7.7KViews0likes2Comments