Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何从客户端计算机连接到BDC服务_.net_Sharepoint - Fatal编程技术网

.net 如何从客户端计算机连接到BDC服务

.net 如何从客户端计算机连接到BDC服务,.net,sharepoint,.net,Sharepoint,我想寻求帮助。 我需要编写远程连接到Sharepoint service(BDC服务)的代码,并在BDC元数据存储中执行任何更新。 在msdn中,我发现了以下示例: using (SPSite site = new SPSite("http://ssdk-server/Pages/Default.aspx")) { using (new Microsoft.SharePoint.SPServiceContextScope(SPServiceContext.GetContext(site)

我想寻求帮助。 我需要编写远程连接到Sharepoint service(BDC服务)的代码,并在BDC元数据存储中执行任何更新。 在msdn中,我发现了以下示例:

using (SPSite site = new SPSite("http://ssdk-server/Pages/Default.aspx"))
{
    using (new Microsoft.SharePoint.SPServiceContextScope(SPServiceContext.GetContext(site)))
    {
         BdcService service = SPFarm.Local.Services.GetValue<BdcService>(String.Empty);
         IMetadataCatalog catalog = service.GetDatabaseBackedMetadataCatalog(SPServiceContext.Current);

         IEntity entity = catalog.GetEntity("http://ssdk-server/sdksamples", "Customer");
         ILobSystemInstance LobSysteminstance = entity.GetLobSystem().GetLobSystemInstances()[0].Value;


         IView createView = entity.GetCreatorView("Create");
         IFieldValueDictionary valueDictionary = createView.GetDefaultValues();
         valueDictionary["Name"] = "some name";
         Identity id = entity.Create(valueDictionary, LobSysteminstance);
     }
 }
我发现了同样的问题,但提出的解决方案(将项目设置框架更改为3.5,将平台更改为x64)对我没有帮助


有人能告诉我,可以远程连接到BDC服务并将任何数据加载到元数据存储吗?如果可以,我该怎么做。

这样连接到远程sharepoint服务器是不可能的。 你应该使用

例如:

    string siteUrl = "http://MyServer/sites/MySiteCollection";

    ClientContext clientContext = new ClientContext(siteUrl);
    Web oWebsite = clientContext.Web;
    ListCollection collList = oWebsite.Lists;

    clientContext.Load(collList);

    clientContext.ExecuteQuery();

    foreach (SP.List oList in collList)
    {
        Console.WriteLine("Title: {0} Created: {1}", oList.Title, oList.Created.ToString());
    }

您可以找到更多示例

无法通过这种方式连接到远程sharepoint服务器。 你应该使用

例如:

    string siteUrl = "http://MyServer/sites/MySiteCollection";

    ClientContext clientContext = new ClientContext(siteUrl);
    Web oWebsite = clientContext.Web;
    ListCollection collList = oWebsite.Lists;

    clientContext.Load(collList);

    clientContext.ExecuteQuery();

    foreach (SP.List oList in collList)
    {
        Console.WriteLine("Title: {0} Created: {1}", oList.Title, oList.Created.ToString());
    }

你可以找到更多的例子

他问的是如何远程连接到BDC服务,而不是如何连接到简单的sharepoint列表。你知道如何从C#CSOM应用程序连接到BDC服务吗?@vmichael不,我不是在问如何远程连接到BDC服务,而不是如何连接到简单的sharepoint列表。你知道如何从C#CSOM应用程序连接到BDC服务吗?@vmichael不知道