How do I upload an image from my gallery to a sharepoint library ?

I want my application to fetch the image from gallery and upload the same image to the Sharepoint library.

I googled for a solution but unable to find one that I could understand.
Anyone who has implemented the same or has a sample with them.
Do reply

Answers

  • @sameerpurohit said:
    I want my application to fetch the image from gallery and upload the same image to the Sharepoint library.

    I googled for a solution but unable to find one that I could understand.
    Anyone who has implemented the same or has a sample with them.
    Do reply

    looking solution for the same.

  • AjaysinhDodiyaAjaysinhDodiya INMember ✭✭
    • use AzureActiveDirectoryAuthenticator and get the accessToken

    • get images from gallery
      using MessagingCenter.Subscribe for pick image from gallery

    • upload Images
      C# using (var client = new HttpClient()) { var SourceContent=ImagebyteArrayContent; client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", acessToken); using (var response = client.PostAsync(new Uri("your tenant.sharepoin.com" + "/_api/web/GetFolderByServerRelativeUrl('/PublishingImages')/Files/add(url='" + filename + "',overwrite=true)"), new StreamContent(new MemoryStream(SourceContent))).Result) { if (response.IsSuccessStatusCode) { success = true; } } }

  • AjaysinhDodiyaAjaysinhDodiya INMember ✭✭

    @AjaysinhDodiya said:

    • use AzureActiveDirectoryAuthenticator and get the accessToken

    • get images from gallery
      using MessagingCenter.Subscribe for pick image from gallery

    • upload Images
      C# using (var client = new HttpClient()) { var SourceContent=ImagebyteArrayContent; client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", acessToken); using (var response = client.PostAsync(new Uri("your tenant.sharepoin.com" + "/_api/web/GetFolderByServerRelativeUrl('/PublishingImages')/Files/add(url='" + filename + "',overwrite=true)"), new StreamContent(new MemoryStream(SourceContent))).Result) { if (response.IsSuccessStatusCode) { success = true; } } }

Sign In or Register to comment.