我可以从以沙盒(部分信任)模式运行的CRM 2011插件创建sharepoint文件夹吗? 有些方法可以在沙箱隔离模式下运行时执行此操作,但在部分信任模式下运行时则无法执行此操作。
WebRequest request = WebRequest.Create(FolderName);
request.Credentials = credentials;
request.Method = "MKCOL";
WebResponse response = request.GetResponse();
response.Close();
SPSite site = new SPSite(url);
SPWeb web = site.OpenWeb();
SPFolder folder = web.GetFolder(url + @"/" + "Contact/");
SPFolder createdFolder = folder.SubFolders.Add(FolderName);
HttpWebRequest httpreq = (HttpWebRequest)WebRequest.Create(FolderName);
httpreq.Credentials = credentials;
httpreq.Method = "MKCOL";
WebResponse response = httpreq.GetResponse();
Dws dwsService = new Dws();
dwsService.Credentials = credentials;
string dwsurl = url + "/_vti_bin/dws.asmx";
dwsService.Url = dwsurl;
string FolderName = "Contact/" + System.Uri.EscapeDataString(listName);
string result = dwsService.CreateFolder(FolderName);