Uploading Image to SharePoint from PowerApps via Flow - sharepoint

As the title says.. I'm building a power app that uploads an image to a sharepoint directory.
Following this blog I was able to successfully upload an image that was captured by a Camera Control.
However, I would like to do the same thing but with an 'Add Picture' Control.
My PowerApp function for doing this is
ClearCollect(PictureCollection2, AddMediaButton2.Media);
MediaToSharePoint.Run("test.png", First(PictureCollection2).Value)
I add the media to a collection, then Run a Flow with the value. This value is a form of a URL that contains the image stored as a blob. Here's an example of the value that gets passed to the Flow
blob:https://create.powerapps.com/79d7f767-4dff-448d-87ec-b3d2f7cdf27d
The flow has two steps; a PowerApp connector and a Share Point Create File
The flow is failing on the second step with a 'Bad Request' error.
Has anyone been able to upload an image to Sharepoint via an 'Add Picture' control?
Any help would be appreciated, let me know if there are any more details I should provide.

We were able to solve the problem by saving pictures to a SharePoint List.
Here are useful links explaining the solution.
"Save Attachments to SharePoint List using PowerApps" (YouTube Video)
"Add attachments to SharePoint lists" (Blog Post)
"Showing List Attachments in a gallery" (Forum Thread)
It's working!

Related

Word Templates not showing up in SharePoint/Teams after being added via PowerAutomate

I've been trying to setup a flow that automatically mirrors (read: copies and creates new) Word templates from one Teams Channel to another.
The goal is to have them appear in the "+ new"-dropdown in sharepoint and teams (see screenshot).
"+new"-dropdown in Teams
I believe I managed to find the path to the folder in which to put the template-file, which is: https://yourcompany.sharepoint.com/sites/YourSiteName/Freigegebene Dokumente/Forms
The "Freigegebene Dokumente" should be "shared documents" in english afaik.
Here comes the caveat:
When I upload a template-file via powerautomate, they do not show up in the "+ new"-dropdown. When I then try to manually add the same file via the "+ new"-dropdown, it tells me that a file with that name already exists.
Am I missing something? I fully expected this to just work.
What I am trying to get running so that the bigger solution can work is this:
Manually trigger a Microsoft PowerAutomate Cloudflow
Get information about a specific file in SharePoint (a .dotx MS-Word template)
Get the content of that specific file
Create a new File in the */Forms folder with the same name and content as seen in the screenshot.
Be able to create a new File in SharePoint (and Teams) from that template via the "+new"-dropdown
The two parameters used are:
#outputs('Dateieigenschaften_abrufen')?['body/{FilenameWithExtension}']
and
#body('Dateiinhalt_abrufen')
Screenshot of the flow
After running this flow, I expect to have a new template to choose from in the "+new"-dropdown in SharePoint. That is not the case.
I know that there is something uploaded, because if I try to manually add the template via the "+new"-dropdown
manual upload in "+new"-dropdown
I get this error message:
Error Message on manual upload

Sharepoint Graph API download file from Document library that are not listed as drive ("Site Pages" and others)

I'm trying to find a way in Sharepoint Graph API how download file in Document library that are not listed as drive (Site Pages and others).
If I enumerating lists, I see "Site Pages" in lists:
https://graph.microsoft.com/v1.0/sites/<site id>/lists
I even can enumerate item in list :
https://graph.microsoft.com/v1.0/sites/<site id>/lists/<list id>/items
But I can't find a way to get a content (download) those items (files).
All available url to download file (get content) are next:
GET /drives/{drive-id}/items/{item-id}/content
GET /groups/{group-id}/drive/items/{item-id}/content
GET /me/drive/root:/{item-path}:/content
GET /me/drive/items/{item-id}/content
GET /sites/{siteId}/drive/items/{item-id}/content
GET /users/{userId}/drive/items/{item-id}/content
Doesn't provides an ability to get the content.
I can't find a way to get drive id for list, and there's no url to get content from list (even if it's documents library).
Please advise.
Thanks
You can call the following endpoints to retrieve:
all document libraries on a site
items in a document library (from root)
download the content of an item
This may not be the most efficient set of queries but I successfully tested in my lab tenant.
https://graph.microsoft.com/(version)/sites/(site-id)/drives
https://graph.microsoft.com/(version)/sites/(site-id)/drive/(drive-id)/root/children
https://graph.microsoft.com/(version)/sites/(site-id)/drive/(drive-id)/items/(item-id)/content
The drive resource represents a user's OneDrive or a document library in SharePoint. while site page is a page library, not document library, this is why it's not returned in drive request.
We suggest you get the file using SharePoint Rest API.
Working with files by using REST

Spfx for creating new draft email with attachment

I need to create spfx button that will upload selected library item/document to new draft email as an attachment. I assume this needs to be done via Ms Graph API (pnp msgraph). Does anybody have samples or suggestions on how can this be done?
Regarding the SPFx button, you will need to create and SPFx ListView Command Set extension. This will enable you to add a button directly into the document library command bar.
This guide should help you with that.
Creating the draft email is a little harder. There are many solutions that you can use to send the mail. The Send Mail MSGraph action is one way.
However, a solution could be to build and launch a mailto: link in your SPFx extension that contains the URL to the selected file in the message body. Not quite an attachment but this would create the draft email and open it in the users email client.
Hopefully this helps get you started

Uploading image to google doc via google form

I'm creating a application form, where users input their info, and after submitting, the form "generates" a google doc with those information and sends that document to my email. That works fine.
My problem is this:
I also need users to upload their picture, and then I have to include that picture inside of that google doc. Can you please help me solve this problem?

Retrieving files from blog media entries

The tool I'm building needs pull data from IBM Connections Ideation Blogs. I therefore use the Connections API with basic authentication to read Blog Entries. This goes well until the description contains images. When I ask the API to provide media resources for the blog, it does not show any entries of the /BLOGS_UPLOADED_IMAGES location - the one containing images uploaded through the blog's richtext editor. The user I use in my API call is the same user who created blog entries and uploaded pictures.
However the API call DOES contain images I publish using the API and a POST request to the blog's media entry collection. This is where the next problem appears. Those Atom entries for images contain various links, one of them with a ref="enclosure", of which the API documentation (link) tells me to "Use the web address in the href attribute to obtain the binary content of the file". However, my calls to this adress are always answered with 404 response code.
Another url in the Atom entry (this time of the element) is described by the same documentation (see link above) as: "Provides access the document's media. The following operation is supported: GET: Use the web address to obtain the media." When I make a call to this url, as always with basic authentication credentials attached, the response contains the html of the login form of Connections, so API authentication does not seem to be supported on this url. This is only the case for non-public communities, which require authentication, of course, if the picture is publicly availabe all works just fine.
Am I missing something out? Is there another way to retrieve the actual image from a blog's media entry through the API? Are manually uploaded pictures never contained in the media entries result or is this a bug?
It now magically works using the link with ref="enclosure" from the atom entry. I might have gotten something wrong with authentication I guess (although I'm not actually realizing what I'm doing different now than I did before).
Problem remaining: Pictures uploaded through the rich-text editor in the folder /BLOGS_UPLOADED_IMAGES do not appear in the media feed of the blog.

Resources