Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using SharePopint as a doc repository for CRM

Status
Not open for further replies.

BigBlueEye

Programmer
Jan 14, 2010
1
US
I've written an application (WinForm app) that creates a SharePoint Document Workspace Site for each entity in CRM. I'm using the various SP webservices to accomplish but I'm only able to stream the file from CRM to an image list in SP using the imaging.asmx webservice.

I'dn really like to be able to stream it into a regular document library but haven't been able to figure out how yet. If anyone could give me some points and example code I'd really appreciate it.

// dws has been created, now migrate the files
foreach (BusinessEntity DocEntity in GetNotes(crmService, _entityID).BusinessEntities)
{
annotation DocReturned = (annotation)DocEntity;
//crmService.Delete(DocReturned);

// Transfer the attachment to the SP site.
imagingWS.Imaging imagingService = new imagingWS.Imaging();
imagingService.Credentials = new System.Net.NetworkCredential(SPCredsUserName, SPCredsPassword);
imagingService.Url = _newurl + "/_vti_bin/IMAGING.asmx";

listsWS.Lists listsService = new listsWS.Lists();
listsService.Credentials = new System.Net.NetworkCredential(SPCredsUserName, SPCredsPassword);
listsService.Url = _newurl + "/_vti_bin/LISTS.asmx";

//create a list for the documents (is a photo gallery list in order to use the imaging upload method)
//check to see if the list exists
if (!ListExists(listsService, "EntityDocuments"))
listsService.AddList("EntityDocuments", "", 109); //create list

using (FileStream fileStream = new FileStream(DocReturned.filename, FileMode.OpenOrCreate))
{
byte[] fileContent = Convert.FromBase64String(DocReturned.documentbody);

//use image upload method to put into list (HOW TO I GET THIS INTO A NORMAL DOCUMENT LIBRARY)
imagingService.Upload("EntityDocuments", "", fileContent, ValidateFilename(DocReturned.filename), true);
}
}
}

} //next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top