I am trying to access a list via LINQ to SharePoint that is part of a different site collection. I am able to create the DataContext object for the other site but when I try to access the DataContext.ListName property I get:
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex)
at Microsoft.SharePoint.Library.SPRequest.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName, Int32 dwBaseType, Int32 dwBaseTypeAlt, Int32 dwServerTemplate, UInt32 dwGetListFlags, UInt32 dwListFilterFlags, Boolean bPrefetchMetaData, Boolean bSecurityTrimmed, Boolean bGetSecurityData, Boolean bPrefetchRelatedFields, ISP2DSafeArrayWriter p2DWriter, Int32& plRecycleBinCount)
at Microsoft.SharePoint.SPListCollection.EnsureListsData(Guid webId, String strListName)
at Microsoft.SharePoint.SPListCollection.GetListByName(String strListName, Boolean bThrowException)
at Microsoft.SharePoint.Linq.Provider.SPServerDataConnection.GetSPList(String url, String listName)
at Microsoft.SharePoint.Linq.Provider.SPServerDataConnection.GetList(String url, String listName)
Do you know what permissions are needed to grant access to the list object? Does it need to be granted to IUSR?
I am able to get this to work with RunWithElevatedPrividges but I would rather not use that everywhere I need to access a list on a different site collection.
