web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / After enable SharePoin...
Power Pages
Suggested Answer

After enable SharePoint integration "Exception Message Sequence contains no elements"

(0) ShareShare
ReportReport
Posted on by 24
I have setup SharePoint integration follow this document: Manage SharePoint documents | Microsoft Learn
 
On one of the page, I inserted a form with the subgrid exactly same as the document. It works for the first time when I load the page. I can successfully upload 2 files.
 
Because I found the files uploaded were saved in subfolder with 'Contact' name instead of 'Account' name. So I change the setting to 'Account'
 
After then the page with the form is throwing error "We're sorry, but something went wrong. Please try again, and if this persists, contact the website administrator."
 

Exception Message
Sequence contains no elements

Stack Trace
   at Microsoft.Xrm.Sdk.Linq.QueryProvider.ThrowException(Exception exception)
   at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups, String& pagingCookie, Boolean& moreRecords)
   at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups)
   at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](Expression expression)
   at Microsoft.Xrm.Sdk.Linq.QueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
   at Adxstudio.Xrm.SharePoint.SharePointResult.get_CanWrite() in C:\__w\1\s\Framework\Adxstudio.Xrm\SharePoint\SharePointResult.cs:line 113
   at Adxstudio.Xrm.Web.UI.CrmEntityFormView.SharePointDocumentsControlTemplate.AddFileUpload(Control container) in C:\__w\1\s\Framework\Adxstudio.Xrm\Web\UI\CrmEntityFormView\SharePointDocumentsControlTemplate.cs:line 94
   at Adxstudio.Xrm.Web.UI.CrmEntityFormView.SharePointDocumentsControlTemplate.InstantiateControlIn(HtmlControl container) in C:\__w\1\s\Framework\Adxstudio.Xrm\Web\UI\CrmEntityFormView\SharePointDocumentsControlTemplate.cs:line 60
   at Adxstudio.Xrm.Web.UI.CrmEntityFormView.TableLayoutRowTemplate.InstantiateLayoutIn(Control container, IEnumerable`1 cellTemplates) in C:\__w\1\s\Framework\Adxstudio.Xrm\Web\UI\CrmEntityFormView\TableLayoutRowTemplate.cs:line 68
   at Adxstudio.Xrm.Web.UI.CrmEntityFormView.TableLayoutRowTemplate.InstantiateIn(Control container) in C:\__w\1\s\Framework\Adxstudio.Xrm\Web\UI\CrmEntityFormView\TableLayoutRowTemplate.cs:line 56
   at Adxstudio.Xrm.Web.UI.CrmEntityFormView.TableLayoutSectionTemplate.InstantiateIn(Control container) in C:\__w\1\s\Framework\Adxstudio.Xrm\Web\UI\CrmEntityFormView\TableLayoutSectionTemplate.cs:line 139
   at Adxstudio.Xrm.Web.UI.CrmEntityFormView.TabTemplate.InstantiateIn(Control container) in C:\__w\1\s\Framework\Adxstudio.Xrm\Web\UI\CrmEntityFormView\TabTemplate.cs:line 190
   at Adxstudio.Xrm.Web.UI.CrmEntityFormView.CompositeTemplate.InstantiateIn(Control container) in C:\__w\1\s\Framework\Adxstudio.Xrm\Web\UI\CrmEntityFormView\CompositeTemplate.cs:line 19
   at Adxstudio.Xrm.Web.UI.WebControls.CrmEntityFormView.CreateChildControls() in C:\__w\1\s\Framework\Adxstudio.Xrm\Web\UI\WebControls\CrmEntityFormView.cs:line 943
   at System.Web.UI.Control.EnsureChildControls()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 
I have tried to change back to Contact and still not work. I have tried to point to another SharePoint site and still same error.
Please help!  I don't have any customization applied.
Categories:
I have the same question (0)
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,449 Most Valuable Professional on at
    The first thing I would do here is delete the Document Location record in the Dataverse
     
    That will delete the SharePoint document reference, and then try uploading a new file
     
    let us know if you need help with the above steps
  • SP2019admin Profile Picture
    24 on at
    I have deleted all records in Document Location record in the Dataverse.  When I load the page with the form, it immediately gave me the same error. I don't even see the form.  If I delete the subgrid of document location and reaload the page, it is working.

    What do you mean by 'delete the SharePoint document reference' ? 
     
    In the F12, I saw:
    GET    https://xxxx.powerappsportals.com/mypagename/   500 (OK)
     
    Do you think Content Security Policy could block some of functions?
     
    Also I have tried enable integration in a modern driven app. It is working but the subgrid is linking to "SharePoint Documents" not "Document locations". I am worrying the document is incorrect. Do you think Power Page need to link to the location not the document?
     
     
    Below screenshot is my current subgrid setup which leading to error.
     
    The last thing I tried is create a new Power Page site, then create a new table, setup the SP integration again. Unfortately I can reproduce the exact error. I think the environment is corrupted somehow. It is a Developer type environment.
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,449 Most Valuable Professional on at
    I haven't used the folder structure setup with Power Pages so I am wondering if that's what's causing the issue
     
    Ultimately, your configuration looks correct
     
    a couple more things you can check:
    • since you are moving the structure to Account-based, what is the permission on the Account table? can you temporarily set it to Global just as a test?
    • if you CSP enabled, can you temporarily disable again to test?
    SharePoint document and Document Location should be the same thing
  • SP2019admin Profile Picture
    24 on at
    Hi Oliver, 
     
    I have tried setup table permission for Account, Contact, SharePoint site, Document Location. (Permission to : Read, Roles: Authenticated Users, Global access) and still the same error.
     
    I have tried building a model driven app and open the same form. It is working fine and I can upload/download documents to/from SharePoint. So I think it is purely Power Page issue.
     
    The error message [Adxstudio.Xrm.SharePoint.SharePointResult.get_CanWrite()] indicate something do not have Write permission.
    In the document (Manage SharePoint documents | Microsoft Learn) it mentioned Write permission several times.
     
    However there is no Write permission. I am not sure what the writer saw when he wrote it on 09/20/2024:
     
    I have also verified the App Reg in Azure Portal. The App reg "PPMI-powerpagesmanagedidentity-xxxxxxxxxxxx" API have Sites.FullControl.All on SharePoint. 
     
    The most weird thing is it was working on my Power Page site for a few minutes at the beginning. I have tried created a new env, a new site, new SP site cannot make it work again. The same error for everything I tried. 
     
    It is really painful to work with Microsoft.
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,449 Most Valuable Professional on at
    so, the write permission is the same as update
     
    I would recommend keeping Create/Update/Read/Append/ Append To
     
    normally Delete is the only one I leave out (depending on the scenario).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Pages

#1
DP_Prabh Profile Picture

DP_Prabh 41

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 31 Most Valuable Professional

#3
Hammed Profile Picture

Hammed 22

Last 30 days Overall leaderboard