Using Sharepoint GridViews on server without SharePoint installed

非 Y 不嫁゛ 提交于 2019-12-11 06:33:01

问题


I have a web application that needs to pull data from a Sharepoint list and display it with the same "look and feel" as a sharepoint list, but on a different web site.

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spgridview.aspx

The web application is not installed on a server with the SharePoint foundation. The sharepoint DLLs were naturally missing, but I have copied them from the server where SP is installed and added them to my project. The page compiles now, but it's throwing an exception which appears whenever I insert the SPGridView ASP element.

The exception is: System.ArgumentException: Absolute path information is required.

Stack trace:

[ArgumentException: Absolute path information is required.]
   System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath) +12658807
   System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) +112
   Microsoft.SharePoint.Utilities.SPUtility.ComputeFileHash(String filePath) +470
   Microsoft.SharePoint.Utilities.SPUtility.MakeBrowserCacheSafeLayoutsUrl(String name, Boolean localizable) +487
   Microsoft.SharePoint.WebControls.ScriptLinkInfo.ToScriptUrl(Page page) +488
   Microsoft.SharePoint.WebControls.ScriptLinkInfo.ToScriptBlock(Page page) +24
   Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language) +1195
   Microsoft.SharePoint.WebControls.ScriptLink.Register(Page page, String name, Boolean localizable, Boolean defer, String language, String uiVersion) +38
   Microsoft.SharePoint.WebControls.ScriptLink.Register(String uiVersion, Page page, String name, Boolean localizable, Boolean defer) +59
   Microsoft.SharePoint.WebControls.ScriptLink.Register(Page page, String name, Boolean localizable) +30
   Microsoft.SharePoint.WebControls.SPGridView.OnLoad(EventArgs args) +86
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064

If I remove the SPGridView ASP element, the page runs. Does anyone know how to get this to work? I know I can use the Client Object Model, but AFAIK it doesn't provide anything to show lists with the same appearance and functionality as in Sharepoint.

来源:https://stackoverflow.com/questions/10747907/using-sharepoint-gridviews-on-server-without-sharepoint-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!