0
  • Hi,

    I am using Office 365 & Sharepoint Online we are developing an asset register to track what user has what equipment. I’ve found your articles really helpful in getting me this far but I’m now stuck trying to get a list of all the users in Sharepoint so I can assigned items to them. I’ve found the following code on several sites that users say works but when I run it I get “Access Denied”. I’ve spoken to 365 support and they say there is nothing they can do as the permissions look fine. Are you able to help me or point me in the right direction?

    Thank you.

    John

            var searchTerm = $(“#txtSearchBox”).val();

            clientContext = new SP.ClientContext.get_current();  

            var keywordQuery = new Microsoft.SharePoint.Client.Search.Query.KeywordQuery(clientContext);

            keywordQuery.set_queryText(searchTerm);

            keywordQuery.set_sourceId(“B09A7990-05EA-4AF9-81EF-EDFAB16C4E31”);

                                   

            keywordQuery.set_rowLimit(500);

            keywordQuery.set_trimDuplicates(false);

            var searchExecutor = new Microsoft.SharePoint.Client.Search.Query.SearchExecutor(clientContext);

            results = searchExecutor.executeQuery(keywordQuery);

            clientContext.executeQueryAsync(onQuerySuccess, onQueryError);

     
    Thanks,
    John
(Visited 25 times, 1 visits today)
Add a Comment