开发者

Why can't I update metadata on an SPFile object?

According to Microsoft's documentation:

The Windows SharePoint Services 3.0 object model supports updating file metadata. You can use an indexe开发者_如何学编程r on this property to set a value. For example, to set the value of the MyDate property for a given file to the current date and time, use the indexer and call the Update method, as follows:

[Visual Basic]

oFile("MyDate") = DateTime.Now

oFile.Update()

[C#]

oFile["MyDate"] = DateTime.Now;

oFile.Update();

But when I write the line of code:

oFile["Test"] = "test";

It errors out with:

Cannot apply indexing with [] to an expression of type 'Microsoft.SharePoint.SPFile'

Am I doing something wrong or did Microsoft screw up?


I don't have SharePoint to try it on right now, but it looks like sample is wrong. I believe it should be oFile.Properties["Test"]="test"; as the article talks about Properties property.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜