使用CSOM在sharepoint 2013中获取删除的列表名称 [英] Getting deleted list name in sharepoint 2013 using CSOM

查看:63
本文介绍了使用CSOM在sharepoint 2013中获取删除的列表名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我需要使用CSOM从Sharepoint获取已删除列表.

I have a requirement to get deleted lists from Sharepoint using CSOM. 

我了解了ChangeQuery.我正在使用以下代码来获取已删除列表.

I got to know about ChangeQuery . I am using following code to get deleted lists.

我正在从中获取列表ID.但是我总是将Title设置为空.请帮助我获取列表名称.

I am getting list id from this. But I am always getting Title as empty. Please kindly help me to get List Name.

或者,请为我建议其他选择,以获取已删除的列表名称

Or Please suggest me some other option to get deleted List Names

推荐答案

以下是一个演示供您参考:

Here is a demo for your reference:

using ConsoleApplicationCommon.DAL.CSOM;
using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplicationCommon
{
    class Program
    {
        static void Main(string[] args)
        {
            RecycleBinItemCollection rbiColl = getRecycleBinItems("http://wakaka:17710/sites/publish_site");
            foreach (RecycleBinItem rbiItem in rbiColl)
            {

                if (rbiItem.ItemType == RecycleBinItemType.List)
                {
                    Console.WriteLine(rbiItem.Title);
                }
            }
            Console.ReadLine();            
        }

        public static RecycleBinItemCollection getRecycleBinItems(string siteURL)
        {
            ClientContext context = new ClientContext(siteURL);
            Web web = context.Web;

            // Get all the recycle bin items  
            // Reference: https://msdn.microsoft.com/EN-US/library/microsoft.sharepoint.client.recyclebinitem_members.aspx                 
            RecycleBinItemCollection rbiColl = web.RecycleBin;
            context.Load(rbiColl);

            // Execute the query to the server  
            context.ExecuteQuery();

            return rbiColl;
        }
    }
}

结果截屏:

最好的问候,

李李


这篇关于使用CSOM在sharepoint 2013中获取删除的列表名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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