嗯,SharePoint 2013 对沙盒不太友好。有很多问题。
在 SharePoint 2010 中,我能够使用以下方法成功地将沙盒 Web 部件嵌入到母版页中:
<WebPartPages:SPUserCodeWebPart runat="server" Description="Description" Title="TITLE"
AssemblyFullName="$SharePoint.Project.AssemblyFullName$" SolutionId="00000000-0000-0000-0000-00000000000"
ID="ID" TypeFullName="Namespace.WP">
</WebPartPages:SPUserCodeWebPart>
但是,当我在 SharePoint 2013 的母版页中添加此内容时,我收到以下错误:
ExecuteRequestInSandBox 调用失败。System.NullReferenceException:对象引用未设置为对象的实例。在Microsoft.SharePoint.WebPartPages.BinaryWebPartSerializer.Serialize(PersonalizationScope范围,BinaryWebPartSerializerFlag binaryWebPartSerializerFlags,BinaryWebPartSerializerWriter作家)在Microsoft.SharePoint.WebPartPages.BinaryWebPartSerializer.Serialize(SerializationMode模式,BinaryWebPartSerializerFlag binaryWebPartSerializerFlags,BinaryWebPartSerializerWriter作家)在Microsoft.SharePoint.WebPartPages.SPUserCodeWebPart.EnsurePersistedBlobsMatchPropertiesCollection () 在 Microsoft.SharePoint.UserCode.SPUserCodeWebPartRemoteExecutionHelper 的 Microsoft.SharePoint.WebPartPages.SPUserCodeWebPart.GetWebPartDataForRemoteCall(Object& viewState, Object& controlState)。