0

我正在使用 SPMeta2 CSOM 代码创建和填充列表、内容类型和列到我的 onpremm 共享点站点,但我找不到创建托管属性的方法。

有什么办法吗,我用谷歌搜索了一下,发现了可以做到的 Powershell 和 SSOM 代码。

4

1 回答 1

0

添加类型-路径“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll”

添加类型 - 路径“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll”

添加类型-路径“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.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());
        }
    }
于 2016-10-13T07:30:08.783 回答