zoukankan      html  css  js  c++  java
  • 生成LINQ to SharePoint Proxy类

    1. 添加引用

      添加对Microsoft.SharePoint.LINQ.dll的引用,它在路径Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\下。

      2. 生成LINQ to SharePoint Proxy类,通过它来访问SharePoint站点中的List

      使用spmetal.exe工具,它能根据SharePoint站点中的List定义生成对应C#或VB.Net类(默认C#),类似于使用WSDL.exe为Web Service生成Proxy类。它存放在路径Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\BIN下。关于它的详细介绍请参阅MSDN:http://msdn.microsoft.com/en-us/library/ee538255(office.14).aspx。

      该命令的使用格式:SPMetal /web:http://ContosoServer/Marketing /code:MarketingSite.cs
         Proxy类的生成后的路径在Code/c:\\MarketingSite.cs

      这是基本的参数,此外还有language、user、password等,不再一一介绍,请参阅MSDN。

      此外,code参数是你对应的CS代码文件的完整路径,如果仅仅是.CS代码文件名,默认存放在Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\BIN下。

      这样生成的类包含了对应站点下所有结构的定义,比如List,Image,Document,以及Item、Folder等等,建议大家仔细看一下。

      生成之后,将该文件附加到我们的控制台应用程序项目中。

    Generate C# code:

     
    SPMetal /web:http://ContosoServer/Marketing /code:MarketingSite.cs

    Generate Visual Basic code with custom parameters settings:

     
    SPMetal /web:http://ContosoServer/Marketing /code:MarketingSite.vb /parameters:MarketingSite.xml
    

    Generate Visual Basic code from a specified user context:

     
     
  • 相关阅读:
    周末总结
    大数据开源框架技术汇总
    oracle迁移mysql总结
    梯度下降
    BFC的概念
    元素类型
    window10安装tensorflow
    学习使用git
    设计模式中的关系
    拟合圆
  • 原文地址:https://www.cnblogs.com/dengdengwang/p/2986795.html
Copyright © 2011-2022 走看看