开发者

Difference between SPFile.Property and SPFile.Item?

开发者 https://www.devze.com 2023-02-19 14:24 出处:网络
I have this code (f is a SPFile object): f.Properties[\"Publish\"] = 0; //f.Properties[\"开发者_如何学CPublishedDate\"] = DateTime.Now;

I have this code (f is a SPFile object):

    f.Properties["Publish"] = 0;
    //f.Properties["开发者_如何学CPublishedDate"] = DateTime.Now;
    f.Update();

If I run this it updates my Publish meta data. If I uncomment the date line it will error out with a type mismatch.

If I use this code:

    f.Item["Publish"] = 0;
    f.Item["PublishedDate"] = DateTime.Now;
    f.Item.Update();

Everything updates as expected. What is the difference between these two methods? Why do they almost do the same thing?


You may want to have a look at a similar question I asked some time ago When is SPFile.Properties != to SPFile.Item.Properties in SharePoint?

0

精彩评论

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