Power Apps Best Method for Storing Images in a SharePoint List Column - sharepoint-online

I have a Power App that will be used to upload a short text message and an image. There will ultimately be several thousands of these images uploaded over the next 12-24 months so I need a reliable method of storing the images in a SP List and a reliable method of displaying the images within the Power App. My SharePoint list column type for storing images is text multi-line. I saving the images via Patch(). I am using an Add Media Button which produces an image attachment that has the name "UploadedImage1".
I have tried two methods for storing the images in a SP list where the column type is text multi-line.
// Has intermittent issues displaying images stored in the SP List
Patch( ShoutoutsData, Defaults( ShoutoutsData ), {
Title: Value(Text(Now(), "[$-en-US]yyyymmddhhmmss")),
Image: UploadedImage1.Image
} )
// Works but Image column is sometimes storing large image files and it does not require very many image uploads before the SP list starts having issues displaying in a browser (you get the "The browser is not responding do you wanna wait" message
Patch( ShoutoutsData, Defaults( ShoutoutsData ), {
Title: Value(Text(Now(), "[$-en-US]yyyymmddhhmmss")),
Image: Substitute(JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData),"""",""),
} )
As noted in the comments above each Patch() formula, there are issues with each method and therefore I need an alternate approach to this. Any recommendations?

When I've done this in the past I've used Base64 and saved it to a sharepoint list as a string.

This is a Power Apps/Power Automate solution to save to OneDrive - Save to SharePoint similar approach:
Create your Power Automate Flow first as this will be needed in Power Apps.
Use Power Apps as the trigger.
Add the Parse JSON step to extract JSON items from the Power Apps trigger. Content should be "Ask In Power Apps", then it will fill in with "triggerBody()['ParseSON-Content']". Schema should be as follows (copy and paste):
{
"type": "array",
"items": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Pic": {
"type": "string"
}
},
"required": [
"Name",
"Pic"
]
}
}
Select Create file step (to one drive). (If saving to SharePoint, use the create or update item step). Add folder path. For File Name, select Parse JSON "Name" in Dynamic content selection.
Due to the nature of the array being passed into Power Automate, when selecting the "Name" from the Parse JSON list, it will invoke an "Apply to each" condition as follows:
For File content, add the expression as illustrated:
The use of the decodeDataUri expression decodes the picture format from Base64 into a format suitable for using in OneDrive (or SharePoint).
Your completed Power Automate Flow should appear as follows:
In Power Apps:
Create your app with the addmedia control and a Save Image button as follows:
Create a collection of the image and name for an image by adding the following to AddmediaButton1 (part of add media control) OnSelect property: ClearCollect(pics, { Pic: UploadedImage1.Image, Name: Rand()&".jpg"}).
Add to the OnSelect property of the SAVE IMAGE button:
a. Set(MyPics, JSON(pics,JSONFormat.IncludeBinaryData)); - create a variable MyPics, formatting the collection "pics" with binary data.
b. Call your power automate flow, passing in the variable "MyPics"created above into the flow.
When you run your Power Apps application, invoke the add media control, it will create the collection when you load or change the image/media. When you go to save the image, it will trigger the flow and result in a file being saved to OneDrive (or SharePoint) with a random file name with the .jpg extension as follows:

Related

I need node js API which build dynamic forms from documents and fill the placeholders?

Is there any way where I can read the doc/pdf file? In the doc file, we have different templates and according to that, the frontend developer will build forms.
The user uploads a specific template like this:
Between [ (S1M1) Person name] (“the Person) of [ (S1M2) Person address] and [ (S1M3.1, S1M3.2, S1M3.3) Tennant(s) name(s)] (the “Tenant”) of [ (S1M4) Address at time of signing].
In the above document, we have some placeholders in round brackets i.e. S1M1 here we have to change the text and also tell the frontend developer to build an input form and if in S1M1 there are more than one persons in this condition we have to build more input fields which are dynamical.

How to store multiple Profile Pictures in NodeJS & Mongodb?

I'm new to mongodb, so pls go easy.
Let's say that I am creating a website where, in creating profile, users can provide multiple profile images which would be presented in a way of carousel later when other check their profile. Let's say the first picture user uploaded should be the first image in the carousel.
And user are allowed to alter the order of images showing by dragging forward or backward in editing session in order to decide which image to be showed first. The key is the order is editable
According to what I learnt so far, I have created a simple document structure to store user's information as below, where username and profile_image were stored.
But, in this way, I am stuck with one picture only. May I know how should I alter the table, so that it allow to store multiple images, as well as the order of images.
May I know what I should do to implement my original function? Is it should be done by making another table to store order?
When I'm saying the order is editable, I'm saying something like this https://i2.wp.com/www.techjunkie.com/wp-content/uploads/2020/11/4-2-scaled.jpg?resize=690%2C1401&ssl=1
[ { username: 'username_1',
profile_image: 'path_of_the_image',
},
{ username: 'username_2',
profile_image: 'path_of_the_image',
}
]

Search for rows in Excel via Microsoft Graph API

I've built a scanner app that scans a barcode which acts as an ID. Now I need to find this item in a SharePoint Excel file using the Microsoft Graph API and perform actions with it.
Note:
The file, sheet, and table are all known beforehand.
For example, I want to retrieve row 5, with the only know parameter being Roll ID: B5
I've tried using filter methods, but they're not ideal for what I'm trying to build. I must be pushing this way over the limit as it's not a SQL database, but is there any way to get what I need?
As far as I understand the limit of microsoft-graph, the only way to perform where query is using the Filter. So far, the filter works for me.
start the session with persist = false, POST /createSession
clear filter, POST /tables/{table}/clearFilters
apply filter, -d "{ criteria: { filterOn: 'Custom', criterion: '=id' } }" POST /tables/{table}/column('{column}')/filter/apply
fetch visible row, GET /tables/{table}/range/visibleView/rows
close the session.
Hope this helps.

Using Docusign REST API to attach document to SignerAttachmentTab

We have defined a template that will be filled in and signed by our customers. In this template we have some fields that we pre-populate along with some documents that we will attach. The customer will fill in other fields and attach more documents. We are using the REST API to generate the sign request. We are able to generate the correct REST request to fill the tabs in the template, set the recipients and successfully send the signature request. All this works great. But now we're trying to get a document attached to the appropriate SignerAttachmentTab in the template and we cannot get REST to accept it.
We've tried using the Documents field but that doesn't work with templates it seems. We created a composite template and then defined a document for the document, server template for the template itself and an inline template to contain the tab data we want to populate. This keeps generating errors about the tab page number not being right. We've tried different values and we've looked over all the forum posts and documentation related to attaching documents to templates and none of them seem to work.
For the document we specify the file to upload, set the document ID and name. In the server template we specify the template ID. In the inline template we create a recipient, set their information, build up the envelope tabs with the data and then add a SignerAttachmentTab for the document. In this tab we set the document ID to match the document ID from the Document element. We set the tabLabel to the label used in the template itself. We've tried setting pagenumber but that doesn't change anything. All we want is for the document to be sent to the customer. When the open it they can double click the attachment field and view the document we're trying to send.
I'm trying to use the recipe explorer to get this to work using raw REST and it keeps failing with the TAB_PAGENUMBER_IS_NOT_IN_DOCUMENT error. It seems like the document is taking precedence over the template. Unfortunately I cannot change the order of the templates in the editor other than setting the sequence # on the server and inline templates. Here's the request that is generated using DocuSign's test system.
{
"compositeTemplates":[{
"document": {
"documentBase64":"<Base64BytesHere>",
"documentId":"2",
"name":"Test.pdf"
},
"inlineTemplates":[{
"recipients":{
"signers":[{
"email":"abc#def.org",
"name":"Person",
"recipientId":"1",
"roleName":"Sender 1",
"tabs":{
"signerAttachmentTabs":[{
"documentId":"2",
"tabLabel":"MyAttachment"
}],
"textTabs":[{
"tabLabel":"someText",
"value":"Value1" }
]}
}]},
"sequence":"2"
}],
"serverTemplates":[{
"sequence":"1",
"templateId":"guid}]
}],
"emailBlurb":"A message",
"emailSubject":"Test",
"status":"sent"
}
I've looked at the existing posts in the forums and either they don't work for my case or they aren't trying to actually attach the documents to the template but simply include them as a document in addition to the template.
Update
Re:
...associate [a] document to the tab so that the signer will be able to click the attachment field in the document and see the document
Yes, you can now do this by using Smart Sections with a documentHtmlDisplaySettings object in the Envelopes:create request. The collapsed (or collapsible) section can be displayed in different ways:
inline
collapsible
collapsed
continue_button
responsive_table
responsive_table_single_column
print_only
Live examples that you can try online
HTML source document
Word source document
Original answer
Re:
But now we're trying to get a document attached to the appropriate SignerAttachmentTab in the template and we cannot get REST to accept it.
You're trying to use the API to add a document to a SignerAttachmentTab?
This is not supported. Only signers themselves add documents to a SignerAttachmentTab. The API can't do it for them.
Is the issue that you want to make sure that a signer attaches (uploads) a document to the envelope as part of the signing ceremony? You can make the tab non-optional (required). But that won't check the contents of the attached file.
You could use a web hook / Connect to check the file(s) that were attached and, if the right files weren't attached, generate another enveloper for the signer.
I figured out what I was doing wrong. For a template without attachments I was using TemplateRole and EnvelopeTabs. But for attachments, trying to include any document would cause the document to override the template. So I switched to composite template with server and inline templates for the template and data. Trying to add documents in various combinations in the various areas where they are allowed generally caused the request to be sent but with no documents.
The final solution was to go back to the original TemplateRole approach but to create the envelope as a draft. After the draft envelope was created I could then add the document to the envelope. But unfortunately to send the envelope you then have to reattach the recipients. I'm looking to clean that up but otherwise it is working for me now.

SharePoint 2013 Online - How to set up a filtered column linked to itself

I am a newbie with SharePoint. I have set up a document library. One of the columns is a unique id for a document. Another column called Related Document is a lookup field that may contain a clickable link to another document's unique id.
How to automatically fill in related document column with the link to the original document? That is, if I make document A be related to document B, I would like to automatically add a relationship from B to A as well. Not sure if it's possible to do with Related items feature - it does not seem to allow a clickable link.
Thank you.
The only way I can realistically see this being done is with a Remote Event Receiver. https://msdn.microsoft.com/en-us/library/office/jj220043.aspx
I can't think of a way out of the box that would do this.
You will need to create a SharePoint Add-in and deploy it to your SP Online instance. The remote code will get hosted on an Azure instance.
The remote code will get triggered when a document is updated.
You can then get a reference to the related document and fill in the related document link field accordingly.
You can pass parameters with the source parameter of SharePoint. This is actually to forward an URL to jump back to, but can be used to automatically pass parameters to the second form of the library.
Here is a small function that opens an upload dialog e.g. to be inserted in a content editor WebPart:
function openUploadDialog(passParameterName, passParameterValue)
{
var dialogOptions = SP.UI.$create_DialogOptions();
dialogOptions.url = "/_layouts/15/Upload.aspx?List=[INSERT_LIST_ID_HERE]&RootFolder=&IsDlg=1&source=%2fSitePages%2f[SOME_SITE_OF_YOURS].aspx%3f" + encodeURIComponent(passParameterName) + "%3d" + encodeURIComponent(passParameterValue);
dialogOptions.width = 700;
dialogOptions.height = 310;
dialogOptions.title = "Submit Document";
dialogOptions.dialogReturnValueCallback = Function.createDelegate(null, CloseThisDocCallBack);
SP.UI.ModalDialog.showModalDialog(dialogOptions);
}
openUploadDialog([NAME_OF_YOUR_ID], [VALUE_OF_YOUR_ID])
Short:
Add a field with the ID (or whatever you want) to your Library
Create a Content Editor or script WebPart where every you want and use the
function to open a dialog
look at the source of this webpart to find out the DOM ID of the field
Add another webpart to your Upload Form (Ribbon => Library => Form Webparts => Default Editor Form) to take the value from the source paramter (e.g. via JQuery) and write it into the new field you've just created.
Something like this:
id = GetUrlKeyValue('[NAME_OF_YOUR_ID]');
$('#[DOM_ID_OF_YOUR_CUSTOM_FIELD]').val(id);
I used this once to add an ID of a list element to the file. Hope that this is what you were looking for.

Resources