Sharepoint 2010 部署步骤添加解决方案时出错
我正在开发沙盒解决方案SharePoint 2010(SharePoint在线项目) 我得到的错误是Sharepoint 2010 部署步骤添加解决方案时出错,sharepoint-2010,sandbox-solution,Sharepoint 2010,Sandbox Solution,我正在开发沙盒解决方案SharePoint 2010(SharePoint在线项目) 我得到的错误是 Error 19 Error occurred in deployment step 'Add Solution': This solution contains invalid markup or elements that cannot be deployed as part of a sandboxed solution. Solution manifest for solution
Error 19 Error occurred in deployment step 'Add Solution': This solution contains invalid markup or elements that cannot be deployed as part of a sandboxed solution. Solution manifest for solution 'c353c02e-f7b0-4c58-b7c6-066adf1d7e0c' failed validation, file manifest.xml, line 3, character 4: The element 'Solution' in namespace 'http://schemas.microsoft.com/sharepoint/' has invalid child element 'CodeAccessSecurity' in namespace 'http://schemas.microsoft.com/sharepoint/'. List of possible elements expected: 'FeatureManifests, Assemblies, ActivationDependencies' in namespace 'http://schemas.microsoft.com/sharepoint/'.
0 0 Starwood_Forms
VisualStudio中的清单文件(Package.Package)如下所示
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="c353c02e-f7b0-4c58-b7c6-066adf1d7e0c" SharePointProductVersion="14.0">
<CodeAccessSecurity>
<PolicyItem>
<PermissionSet class="NamedPermissionSet" version="1" Description="Permission set for ProjectNameHere.">
<IPermission class="AspNetHostingPermission" version="1" Level="Minimal" />
<IPermission class="SecurityPermission" version="1" Flags="Execution,ControlPrincipal,ControlAppDomain,ControlDomainPolicy,ControlEvidence,ControlThread" />
<IPermission class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" version="1" ObjectModel="True" />
<IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="UserName" />
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="$AppDir$" Write="$AppDir$" Append="$AppDir$" PathDiscovery="$AppDir$" />
</PermissionSet>
<Assemblies>
<Assembly Name="ProjectNameHere" />
</Assemblies>
</PolicyItem>
</CodeAccessSecurity>
<Assemblies>
<Assembly Location="ProjectNameHere.dll" DeploymentTarget="GlobalAssemblyCache">
<SafeControls>
<SafeControl Assembly="ProjectNameHere, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7e39ecec9e69afb4" Namespace="ProjectNameHereWebPart" TypeName="*" />
</SafeControls>
</Assembly>
</Assemblies>
<FeatureManifests>
<FeatureManifest Location="ProjectNameHere_Feature2\Feature.xml" />
</FeatureManifests>
</Solution>
当代码试图创建一个新的列表项时,我得到了上面的错误
我正在使用沙盒可视web部件
如果我从“解决方案”中删除“CodeAccessSecurity”子元素,但我无法创建新的列表项,则该解决方案将被激活,不会出现任何问题。我正在使用LINQ to SharePoint创建一个新的列表项如果我不使用数据上下文来创建新的列表项,那么下面的代码可以很好地工作
SPList list = objWeb.Lists.TryGetList("ListName");
SPListItem newListItem = list.AddItem();
newListItem["Department"] = new SPFieldLookupValue(int.Parse(ddlDepartment.SelectedValue), ddlDepartment.SelectedItem.Text);
newListItem.Update();
如果你有任何其他想法,请让我知道
SPList list = objWeb.Lists.TryGetList("ListName");
SPListItem newListItem = list.AddItem();
newListItem["Department"] = new SPFieldLookupValue(int.Parse(ddlDepartment.SelectedValue), ddlDepartment.SelectedItem.Text);
newListItem.Update();