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.

 

posted on 2006-09-07 15:38  有些伤感  阅读(355)  评论(1编辑  收藏  举报