总结:Sharepoint2010 Client Object Model -- Managed Client

 

Managed Client:

1. 需要添加引用: Add Reference:

             Microsoft.SharePoint.Client.dll;

             Microsoft.SharePoint.Client.Runtime.dll

     路径:一般情况下在:C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI;

 

 2. 可以使用的Class:

    

客户端 服务器

ClientContext

SPContext

Site

SPSite

Web

SPWeb

List

SPList

ListItem

SPListItem

Field

SPField

 

3. Code:

 

   public void GetCurrentUser()

        {

            ClientContext context = new ClientContext("http://localhost");

            Web site = context.Web;

 

            //context.Load(site);

            //context.ExecuteQuery();

 

            if (site != null)

            {

                User user = site.CurrentUser;

 

                context.Load(user);

                context.ExecuteQuery();

 

                string userName = user == null ? string.Empty : user.LoginName;

 

                Console.WriteLine(userName);

            }

        }

 

你可能感兴趣的:(SharePoint)