hqdev
asked on
Upload picture to a SharePoint Picture Library from URL
Hi Experts,
I'm trying to upload a picture to a SharePoint picture library from my ASP.NET application.
I can do it from a local file, but I want to take a default picture from the picture library itself and upload a copy of that with a different name.
I've included the code which work for a local file but not from a URL.
Thanks
I'm trying to upload a picture to a SharePoint picture library from my ASP.NET application.
I can do it from a local file, but I want to take a default picture from the picture library itself and upload a copy of that with a different name.
I've included the code which work for a local file but not from a URL.
Thanks
Dim docSetFolder As Folder = oWebsite.GetFolderByServerRelativeUrl("http://p605912/FichesContacts")
Dim fci As New FileCreationInformation()
fci.Url = "http://p605912/FichesContacts/" & strMat & ".png"
fci.Content = System.IO.File.ReadAllBytes("http://p605912/FichesContacts/$90000000.png") <=== DOESNT WORK FOR URL ONLY FOR LOCAL
Dim documentFiles As FileCollection = docSetFolder.Files
clientContext.Load(documentFiles)
Dim newFile As File = documentFiles.Add(fci)
clientContext.Load(newFile)
oListItem = newFile.ListItemAllFields
oListItem("TypeNo") = "Individu"
oListItem("NomFamille") = Trim(IIf(IsDBNull(r.Item("indv_nom")), "", r.Item("indv_nom")))
oListItem("Prenom") = Trim(IIf(IsDBNull(r.Item("indv_prenom")), "", r.Item("indv_prenom")))
oListItem("Telephone") = Trim(IIf(IsDBNull(r.Item("indv_tel")), "", r.Item("indv_tel")))
oListItem("courriel") = Trim(IIf(IsDBNull(r.Item("indv_email")), "", r.Item("indv_email")))
oListItem("cellulaire") = Trim(IIf(IsDBNull(r.Item("indv_cel")), "", r.Item("indv_cel")))
oListItem("Emplacement") = Trim(IIf(IsDBNull(r.Item("indv_emp")), "", r.Item("indv_emp")))
oListItem("Direction") = Trim(IIf(IsDBNull(r.Item("indv_dir")), "", r.Item("indv_dir")))
oListItem("vp") = Trim(IIf(IsDBNull(r.Item("indv_vp")), "", r.Item("indv_vp")))
oListItem("Superieur") = Trim(IIf(IsDBNull(r.Item("indv_supname")), "", r.Item("indv_supname")))
oListItem("Site") = Trim(IIf(IsDBNull(r.Item("indv_site")), "", r.Item("indv_site")))
oListItem("Edifice") = Trim(IIf(IsDBNull(r.Item("indv_edifice")), "", r.Item("indv_edifice")))
oListItem("matsup") = Trim(IIf(IsDBNull(r.Item("indv_supmat")), "", r.Item("indv_supmat")))
oListItem("Fonction") = Trim(IIf(IsDBNull(r.Item("indv_fonction")), "", r.Item("indv_fonction")))
oListItem.Update()
clientContext.Load(oListItem)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER