0

I have a sharepoint online provider-hosted (Azure) add-in. It worked properly when debugging and it works properly when I deploy it to my devsite. The problem occurs when I deploy it to any other site - I get the following error :

List 'Documents' does not exist at site with URL 'https://xxxxxxxx.sharepoint.com/sites/xxxxxxx'

The thing is - I checked this multiple times on multiple sites, the List names are the same as on devsite.

Here are some parts of my Elements.xml, Default.aspx and AppManifest.xml, I have literally no idea what could be causing this but my intuition tells me it could be connected to those lines :

  <CustomAction 
            RegistrationType="List"
            RegistrationId="{$ListId:Shared Documents;}"
            Location="CommandUI.Ribbon"
            Sequence="10001"
            Title="Invoke &apos;RibbonApprovalAction&apos; action">

<AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web/list" Right="FullControl" />

                using (var clientContext = spContext.CreateUserClientContextForSPHost())
                {

                    clientContext.Load(clientContext.Web,
                    web => web.Title,
                    web => web.CurrentUser,
                    web => web.Lists);

                    List doclist = clientContext.Web.Lists.GetByTitle("Documents");

                    clientContext.ExecuteQuery();

The error occurs at the last line, when I try to execute querry. But like I said, it works perfectly on my devsite. It's as if Shared Documents on devsite were different from Shared Documents on any other site... I don't get it.

  • could you try it as clientContext.Web.Lists.GetByTitle("Shared Documents"); ? – Gautam Sheth Sep 1 '17 at 5:25
  • I did try it, I also tried putting %20 instead of the space even though it doesn't make any sense and it didn't work either. – Qya Sep 1 '17 at 7:32
0

Okay so if anyone is interested - I found an answer on StackOverflow posted here posted by user Aarti. I used the list validate function instead of this

List doclist = clientContext.Web.Lists.GetByTitle("Documents");

to get the List instead and now it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.