tips1+1 sharepoint开发杂记

1.stsdev要手工添加
代码段
using Microsoft.SharePoint.WebPartPages;
代码段
        private System.Web.UI.Control _innerUserControl;
        protected override void CreateChildControls() {
            _innerUserControl = this.Page.LoadControl("/bin/msglistUI.ascx");
            Controls.Add(_innerUserControl);
        }
        protected override void RenderWebPart(HtmlTextWriter output)
        {
            this.EnsureChildControls();
            _innerUserControl.RenderControl(output);
        }

2.数据库的连接最好的sqlserver登陆而不是windows登陆,sharepoint不支持internal securite或者trueconnecte string
3.权限问题:
<trust level="WSS_Minimal" originUrl="" /> 改成 <trust level="Full" originUrl="" />
其实,最好不要设置trust level 为full,
我们可以修改WSS_Minimal的配置, 添加如下代码
<SecurityClass Name="FileIOPermission" Description="System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />         
<IPermission class="FileIOPermission" version="1" Unrestricted="true" /> 
在AssemblyInfo.cs文件加入using System.Security;
然后加入程序集关联的信息[assembly:AllowPartiallyTrustedCallers]重新编译就行了
4.不要在web组件里使用webpartmanager之类的东东,否则会触发init page之前...之类的错误。
5.修改web.config的safe control项

你可能感兴趣的:(SharePoint)