Create an Excel file based on the infopath form and upload it to the specified document library in Sharepoint.
Create Document Library
Spsite site =NewSpsite (siteurl); splistitem item= Site. allwebs ["website name"]. Lists ["List name"]. Folders. Add ("Document Library URL", Spfilesystemobjecttype. folder); item ["Name"] = Your folder name; Site. rootweb. allowunsafeupdates=True; Item. Update (); site. rootweb. allowunsafeupdates=False;
Upload a file to a specified document library
Filestream FS =New Filestream (direct, filemode. Open, fileaccess. Read); binaryreader br = New Binaryreader (FS); byte [] filecontents = Br. readbytes (( Int ) Fs. Length); br. Close (); FS. Close (); spfolder folder = Site. rootweb. getfolder ( " Document Library URL " ); String Foldername = URL of the uploaded document;Site. rootweb. allowunsafeupdates=True;
Spfile sofle = Folder. Files. Add (Foldername, filecontents, True );
Site. rootweb. allowunsafeupdates = False ;