I have 2 sites for 2 different groups. One group has access to site1 and one group has site2. Each group does not have access to the others site.
I have a query however that needs to access each site upon entry of a field to see if it exists. Unfortunately the query will fail due to the user not having access to one of the sites.
Is there a way that I can pass credentials that have access to query?
This is my code:
var clientContext = new SP.ClientContext('https://mysite.sharepoint.com/site/site1/'); var oList = clientContext.get_web().get_lists().getByTitle('list'); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'Title\'/>' + '<Value Type=\'Text\'>'+check+'</Value></Eq></Where></Query></View>'); this.collListItem = oList.getItems(camlQuery); clientContext.load(collListItem, 'Include(Id, DisplayName)'); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));