开发者

Retrieving SharePoint Services Site Column Data

开发者 https://www.devze.com 2022-12-12 23:57 出处:网络
I am new to SharePoint Services and I hit a wall with one of my tasks. I need to retri开发者_JAVA百科eve data from a Site Column. How do I get about that? So far I only see APIs that can retrieve list

I am new to SharePoint Services and I hit a wall with one of my tasks. I need to retri开发者_JAVA百科eve data from a Site Column. How do I get about that? So far I only see APIs that can retrieve lists and not site columns.

Please let me know if any of you know to do this.

Thanks !!


using(SPSite site = new SPSite("http://portal"))
{
    using (SPWeb web = site.RootWeb)
    {
        foreach (SPField field in web.Fields)
        {
            Console.WriteLine(field.Title);
        }
    }
}

These will give you all the columns for a web (in this case, the RootWeb). If your site column is related to a list, you need to get directly from the SPListItem property (ex.: item["CustomAssociatedColumn"])

0

精彩评论

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