我使用SPMeta2 CSOM代码来创建和填充列表,内容类型和列到我的onpremm sharepoint网站,但我找不到一种方法来创建托管属性。
有什么办法做到这一点,我已经谷歌,刚刚发现Powershell和SSOM代码可以做到这一点。
Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15ISAPIMicrosoft. sharepoint . client .dll"
Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15ISAPIMicrosoft. sharepoint . client . runtime .dll"
添加- type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15ISAPIMicrosoft. sharepoint . client . search .dll"
try
{
var User = "userName";
var Password = "password";
var SiteURL = "http://siteUrl/";
var domainName = "domain name";
var xDocument = XDocument.Load(@"C:MyFile11.xml");
string xml = xDocument.ToString();
var context = new Microsoft.SharePoint.Client.ClientContext(SiteURL);
context.Credentials = new NetworkCredential(User, GetSecurePassword(Password),domainName);
var searchConfigurationPortability = new Microsoft.SharePoint.Client.Search.Portability.SearchConfigurationPortability(context);
var Search = new Microsoft.SharePoint.Client.Search.Portability.SearchConfigurationPortability(context);
var Owner = new Microsoft.SharePoint.Client.Search.Administration.SearchObjectOwner(context, SearchObjectLevel.Ssa);
//Export search conf schema
var SearchConfig = Search.ExportSearchConfiguration(Owner);
context.ExecuteQuery();
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(SearchConfig.Value);
xdoc.Save("myfilenameSSA.xml");
// import search conf schema
Search.ImportSearchConfiguration(Owner, xml);
context.ExecuteQuery();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}