开发者

List all surveys programmatically in SharePoint 2010?

I need to change some permissions for all surveys in a SharePoint 2010 site collection, how can I list them?

For example to list document libraries I can do

            SPSite oSiteCollection = SPContext.Current.S开发者_高级运维ite;
            SPWebCollection collWebsite = oSiteCollection.AllWebs;
            foreach (SPWeb web in collWebsite)
            {
        SPListCollection collList = web.Lists;

                foreach (SPList oList in collList)
        {
                if (oList is SPDocumentLibrary)
                {
                   // Do something
                }
        }
            }

Thanks in advance.


As your if statement use

if (oList.BaseType == SPBaseType.Survey)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜