如何使用sharepoint app客户端对象模型获取公告列表中的当前列表项 [英] How to get current list item in announcement list using sharepoint app client object model
问题描述
Hello Team,
如何使用SharePoint应用程序客户端对象模型来获得公告列表当前列表项
           &NBSP ;                       //获取从公布名单
&NBSP当前项目;                              SPListItem announcementlistitem = properties.ListItem;
             &NBSP ;                 //存储
&NBSP当前项目的模板布局;               &NBSP ;            string templatelayout = Convert.ToString(announcementlistitem [" TemplateLayout"])。分割('#')[1];
                       //存储
&NBSP当前项的描述;                           string templatedescription = Convert.ToString(announcementlistitem [" Body"]);
               //存储
&NBSP当前项目的模板称号;               &NBSP ;              string templatetitle = Convert.ToString(announcementlistitem [" Template"]));
                   int itemcount;
以及如何在发布字段中添加每个人,下面的代码是服务器端如何在客户端调用。
//如果PublishTo字段被组织添加每个人都在发布字段
            if(publishto ==" Organization")
{
用户ouser = properties.Web.EnsureUser(QUOT;每个人");
             &NBSP ;  SPFieldUserValueCollection value = new SPFieldUserValueCollection();
value.Add(新FieldUserValue(properties.Web,ouser.ID,ouser.Name));
          &NBSP ;     announcementlistitem ["发布]] =值;
                announcementlistitem.Update();
}
请举例。
谢谢,
Lakshmi
< hr>
chinnu
请检查以下主题。
Hello Team,
How to get current list item in announcement list using sharepoint app client object model .
//Gets current item from announcement list
SPListItem announcementlistitem = properties.ListItem;
//store the template layout of current item
string templatelayout = Convert.ToString(announcementlistitem["TemplateLayout"]).Split('#')[1];
//store the description of current item
string templatedescription = Convert.ToString(announcementlistitem["Body"]);
//store the template title of current item
string templatetitle = Convert.ToString(announcementlistitem["Template"]);
int itemcount;
and how to add everyone in publish field , the fallowing code is server side how to call in client side.
//if PublishTo field is Organization add Everyone in Publish field
if (publishto == "Organization")
{
User ouser = properties.Web.EnsureUser("Everyone");
SPFieldUserValueCollection value = new SPFieldUserValueCollection();
value.Add(new FieldUserValue(properties.Web, ouser.ID, ouser.Name));
announcementlistitem["Publish"] = value;
announcementlistitem.Update();
}
Please any examples .
Thanks,
Lakshmi
chinnu
Please check the below thread.
这篇关于如何使用sharepoint app客户端对象模型获取公告列表中的当前列表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!