现在的位置: 首页 > 综合 > 正文

How to Access the DOM(Document Object Model) in MOSS 2007

2011年05月27日 ⁄ 综合 ⁄ 共 645字 ⁄ 字号 评论关闭

Firstly you can get the Document Lib Object from SPList Class.
Then use Files.Add method to add a new file.
If you want to add some properties to the file, use Properties.Add method.
Don't forget use the Update method after you change the properties of a SPListItem.

The core code is just like:

SPWeb web = site.OpenWeb();

SPList spl = web.Lists["YourListName"];

spli.Properties.Add("","");

spli.Update();

Pay attention to the difference between SPListItem and File.

Use File.OpenBinary to read the file and File.SaveBinary to write it.

Use File.Delete to delete a file if you want to.

One more thing, if you want a popup window where you can select 'ReadOnly' or 'Edit' when you click the file's link, try to find the DispDocItemExWithOutContext function in JS file.

 

抱歉!评论已关闭.