在sharepoint列表中增加审批功能后的问题(不断更新中)

本文介绍了一种通过自定义WebPart来显示文档库中待审批文件的方法。利用C#代码遍历子站点中的所有列表,并筛选出启用审核的文档库,最终获取到处于待审状态的文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在增加审批后可以通过新增加的两种视图方式查看列表,但如果通过自定义WebPart只能显示列表功能中被允许(审批通过)的File.如何能自定义显示的类型? 可以通过以下代码获得

 1 None.gif SPSite siteCollection  =  SPControl.GetContextSite(Context);
 2 None.gifSPWebCollection subSites  =  siteCollection.AllWebs;
 3 None.gif
 4 None.gif foreach  (SPWeb site  in  subSites)
 5 ExpandedBlockStart.gifContractedBlock.gif dot.gif {
 6InBlock.gif    SPListCollection lists = site.Lists;
 7InBlock.gif
 8InBlock.gif    foreach (SPList list in lists)
 9ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
10InBlock.gif        if (list.BaseType == SPBaseType.DocumentLibrary)
11ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
12InBlock.gif            SPDocumentLibrary docLibrary = (SPDocumentLibrary)list;
13InBlock.gif
14InBlock.gif            if (!docLibrary.IsCatalog && docLibrary.EnableModeration == true)
15ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
16InBlock.gif                SPQuery allItemsQuery = new SPQuery();
17InBlock.gif
18InBlock.gif                allItemsQuery.ViewAttributes = "ModerationType='Moderator'";
19InBlock.gif
20InBlock.gif                SPListItemCollection docLibItems = docLibrary.GetItems(allItemsQuery);
21InBlock.gif
22InBlock.gif                foreach (SPListItem docLibItem in docLibItems)
23ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
24InBlock.gif                    if (docLibItem.ModerationInformation.Status == SPModerationStatusType. Pending)
25ExpandedSubBlockStart.gifContractedSubBlock.gif                    dot.gif{
26InBlock.gif                        Response.Write(site.Url + "/" + docLibItem.File.Url);
27ExpandedSubBlockEnd.gif                    }

28ExpandedSubBlockEnd.gif                }

29ExpandedSubBlockEnd.gif            }

30ExpandedSubBlockEnd.gif        }

31ExpandedSubBlockEnd.gif    }

32ExpandedBlockEnd.gif}

33 None.gif

 

转载于:https://www.cnblogs.com/shadowgod/archive/2006/07/06/443981.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值