如何使用sharepoint app客户端对象模型获取公告列表中的当前列表项 [英] How to get current list item in announcement list using sharepoint app client object model

查看:104
本文介绍了如何使用sharepoint app客户端对象模型获取公告列表中的当前列表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

解决方案

请检查以下主题。


HTTP:/ /social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/9a6010c1-4043-41fc-80a0-29f37acffc29


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.

http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/9a6010c1-4043-41fc-80a0-29f37acffc29


这篇关于如何使用sharepoint app客户端对象模型获取公告列表中的当前列表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆