# Upload document to SharePoint document library using batch in C#

I want to know if i can upload a document to sharePoint document library using batch in C#. I know how to update and delete it using batch, but i don't know how to upload it.

If i can't, what is the best way to upload a document with metadata?

Thanks alot.

-

I think it can't be done. So i did the following:

1- I uploaded a document to the document library using a web request.
2- I updated the metadata of this document using the batch update command.

If anyone have a different approach please share it.

Thanks.

-

I don't know how to add metadata. But to upload a document you can map the document library to an unused drive letter and copy the file to the document library

net use x: \\path\to\sharepoint\document\library
copy foo.bar x:

-

Try

Dim strUrl As String = spWeb.Lists("DocLib").RootFolder.ServerRelativeUrl.ToString()

Dim spFolderCollection As SPFolderCollection = spWeb.GetFolder(strUrl).SubFolders

Dim spFolder As SPFolder = spFolderCollection.Item("FolderName")