如何使用AllDocs表得到的SharePoint文件创建者的名字吗?创建者、如何使用、名字、文件

2023-09-06 23:05:23 作者:一阵刺心的痛

如何获得以下有关SharePoint文档信息。

How can I get following information about a SharePoint document.

创建 在上次修改

我使用SharePoint内容数据库alldocs表,但无法找到它非常有用。

I am using alldocs table of sharepoint content database but can't find it very helpful.

推荐答案

如果您在触摸alldocs表,你是不是使用对象模型。而且它不支持,通常是一个坏主意。下面是一些示例code。使用对象模型来获取同样的信息:

If you are touching the alldocs table, you aren't using the object model. Further it isn't supported and is generally a bad idea. Here is some sample code to get that same information using the object model:

using (SPSite site = new SPSite("http://your.sharepoint.server/"))
{
    using (SPWeb web = site.OpenWeb())
    {
        SPList list = web.Lists["Documents"];
        SPListItem item = list.Items[0];
        string author = (string)item["Author"];
        DateTime modified = (DateTime)item["Modified"];
    }
}
 
精彩推荐
图片推荐