Power Automate - Copy List Comments from one Item, Paste Them to Another Item - httprequest

Up front, apologies for no pictures. I can't access Stack Overflow from my workspace; and I can't access my flow from home. Additionally, I'm fairly new to Power Automate, with only about a year under me.
I have created a flow, which effectively archives a SharePoint list item. It takes that item from List A, copies it, then creates a new list item in List B--pasting in all the previous column data into the new item. Pretty easy.
However, I also want to copy the Comments from that list item, and move those Comments to the new item in List B. I've already created a "Send HTTP request..." using GET to acquire the original comment data (code below). I've tested it, and it works.
_api/web/lists/getbytitle('[List Name]')/items('[ID]')/Comments
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose"
However, after I've created the new list item in List B, how do I paste this data in, so that the comment button?
I've tried several things, each with failed results:
I've tried utilizing the PUT, PATCH and DELETE methods for HTTP requests. Apparently, /Comments does not support those methods. This means I'm stuck with GET and POST.
So, in my 2nd HTTP request, I utilized the POST method. In the 'body' section of the request, I used the following expression:
outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['results']
This continues to error out. I'm convinced I'm making some kind of rudimentary mistake. Can someone show me an example of how they've done this?

Related

Send data from list in SharePoint in Microsoft 365 to external API

I have a list in "SharePoint in Microsoft 365" and am looking to extend its usefulness. I would like to create a button or something that can take a row of data and send it to an external site via API (another tool that we have created).
To be clear:
SharePoint initiates a GET or POST request
the request must have row or field data attached
the destination is outside of Microsoft/SharePoint
Can it be done?
(Apologies if this is a repeat question, I could only find answers that pertained to older versions of SharePoint and focused on hitting external APIs to retrieve data, not send it.)
OK, i think the best choice to send Data from a selected row, is to use the ListView Command Set here you can do anything with #pnp/nodejs.
Otherwise...
PowerAutomate can help send data.

Downloading a CSV file, secured by authorization, with a click on a button

I'm trying to get Excel to download a CSV file, from a link that changes by the day, with a click on a button. The thing is, it's locked behind an agreement-number, ID and password.
I, however, got two API tokens:
TheAppSecretToken
TheAgreementGrantToken
The link is:
https://secure.e-conomic.com/secure/generelt/exportdata2.asp?mode=doexport&kartotek=5&fradato=01-01-2017&tildato=01-02-2018&vcseparator=%3B&vcQualifier=%22
If people have another way, than using a VBA-code, to download this file with a click on a button, don't hold back with the suggestion.
I appreciate any help I can get, thank you. :-)
EDIT: It's not a duplicate for another question, as this uses Tokens, and or 3 login informations.
EDIT2: nvm. that the link is changing from day-to-day, I figured out that I can just put the date as far out in the future, as I like.
Edit:
I assume that the login call needs to be an POST request, but this is only a guess as I can't test it with the information you have given
Just change the loginBody with the information you need or change it to the format that the URL needs (like JSON) and you can send as many information as need
If needed you can also set more headers for any other tokens you have
URL = "YOURURL"
loginBody = "username=username&password=password&token=token"
HttpObj.Open("POST", URL)
HttpObj.SetRequestHeader("Content-Type","application/x-www-form-urlencoded")
HttpObj.Send(loginBody)
Old answer:
As I'm not allowed to comment it seems what you are trying to do is explained here:
How do i download a file using VBA (Without internet explorer)

VBA send XMLHttpRequest from Internet Explorer

tl;dr: How can one send a POST request in VBA by using an XMLHttpRequest within the Internet Explorer?
I'm about automating the use of page on the internet. The idea is to start from Excel to gather some data in a worksheet, then transfer these data to the internet page, click some buttons in the meantime, and thereafter work on manually.
I recorded the whole process when executed manually by the F12 Developer tools. By bringing the data into the textboxes of the internet page, some Javascript events take place which fire a POST request through XMLHttpRequest:
Now, by replicating the procedure described above in VBA (using getElementById, .click(),.value= and the like), it appears that the relevant events are not fired: no such POST request as shown above are sent to the server, and no additional masks open. This is why I wanted to omit the textbox-filling-and-clicking approach and simply replicate the POST request.
How can I do this from VBA by using the Internet Explorer?
Disclaimer: I'm aware how to send a POST request using MSXML2.serverXMLHTTP, which is described hundreds of times over the web. However, there it's always either-or: either use the Internet Explorer, or MSXML2.serverXMLHTTP. However, I need the request within the Internet Explorer.
These links looks promising |VB5| C# |
Navigate method, 4th argument |Another VB example using StrConv for byte array conversion|
It looks like you simply use the Navigate method and simply data packed into a byte array for the fourth argument. One of the above links is old but the newer link looks very similar so I think the interface has not changed much.
Do please post feedback.

How to write filter {key} for a 'get items as xlsx' request via Podio API

I'll get this out of the way first: I'm an amateur programmer (at best)...i have some knowledge of how APIs work, but little to no experience manipulating the podio API directly (ie I use zapier/globiflow a lot and don't write any php/ruby). I'm sure other people can figure this out via the API documentation, but I can't. So i'm really hoping someone can help clarify and give some more detailed instruction.
My Overall objective:
I frequently export podio files as xlsx from the podio front-end. This is used by my team and me to do regular data analysis tasks in excel. I would like to make this process easier by automating the function of getting an updated podio export into my excel. My plan is to do this via excel VBA. I understand from other searching that it is possible to send an HTTP request using VBA, so i want to make sure i understand what I need to send to the Podio API to get what I need. The method of how to write the HTTP request in excel VBA is outside the intentional scope of this question (though i'd accept any help on this!)
What I've tried so far:
I know that 'get items as xlsx' is part of the podio API: https://developers.podio.com/doc/items/get-items-as-xlsx-63233
However I cannot seem to get this to work in the sandbox environment on that page so that i can figure out a valid request url. I get this message: 'Invalid filtering key' ... because i have no idea how to fill in that field. The information on that page is not clear on this. Nor is it evident on the referenced 'views page'. There are no examples to follow!
I don't even want to do any filtering. I just want to get ALL items in the app. Or i can give it a pre-existing view_id, but that doens't seem to work either without a {key}
I realise this is probably dead simple. Please help a noob? :)
Unfortunately, the interactive API sandbox does not behave appropriately for this particular endpoint. For filtering, this API endpoint expects query string parameters where the field-value pairs consist of integer field IDs and the allowed values for each field. Filtering by fields is totally optional. It looks like this sandbox page isn't built for this kind of operation with dynamic query string field names; wherever you see the {key} field on that page is meant as a placeholder for whatever field IDs that you would use for filtering.
If you want to experiment with this endpoint, I would encourage you to try another dedicated HTTP client first. I was able to get this simple example working with the command-line program wget:
wget --header="Authorization:OAuth2 $MY_SECRET_TOKEN" \
--content-disposition \
"https://api.podio.com/item/app/16476850/xlsx/"
In this case, wget downloaded an Excel file containing all the items in my app without any filtering applied. The additional --content-disposition argument tells wget to save the output as a file with a name using the information in the server's Content-Disposition response header.
With a filter applied:
wget --header="Authorization:OAuth2 $MY_SECRET_TOKEN" \
--content-disposition \
"https://api.podio.com/item/app/16476850/xlsx/?130654431=galaxy"
In this case, the downloaded file filtered the results to items where field id 130654431 (which is a category field) contain the value galaxy.

Sharepoint 2010 and infopath - access workflow variables?

I have a workflow which runs every time a new list item is added.
The list item comprises of 3 fields:
a question,
a person to answer the question,
an answer.
The first 2 fields are supplied by the user who creates the list item, and the workflow routes the item to the expert who supplies #3, the answer.
On the answer form, I would like the question field to be populated with the question, however I can't drag the question field onto the form without it creating a repeating section, when it should be creating a textbox? It says the type is a group rather than just a string?
I'd also like to know how to get workflow variables into InfoPath forms.
Any ideas on how I'd go about creating a simple q&a collection workflow would be most appreciated.
The tl;dr part is the workflow needs to do this :
ask a question and specify a named user
route to user via workflow
get an answer from user
and that's it.
Your first issue is caused by the fact that your question node is a repeating node in your xml schema (see Data, Show fields, then double click the node and see that the Repeating check box is ticked). I suspect you probably wanted a repeating group with Question and Answer nodes. You would then drag the group onto the form. However it might be easier to simply hard code your schema to a specific number of questions as it'll save a bit of jiggery pokery getting the question text loaded in as you'll see below.
The second part is a little more involved and there are few good explainations on the web on how to do it. I have 2 books and neither are great at explaining this! Firstly you need to create a secondary datasource in the form and link it to an ItemMetadata.xml file which contains
<z:row xmlns:z="#RowsetSchema" ows_Question1="" />
<z:row xmlns:z="#RowsetSchema" ows_Question2="" />
etc. - note no root node exaclty like shown.
Then in your workflow you can set the value that your form will get in this secondary datasource at runtime by using something like:
MyFirstTaskTaskProperties.ExtendedProperties["Question1"] = "The text
of question 1";
In your infopath form you should set the default value of Main datasource question field to the node in the secondary datasource. Then when the thing runs it will work.
I hope you are reasonably familiar with SharePoint workflows as there are quite few other things you need to do to get an infopath form working in a workflow. In my experience it's quite painful getting it all working. Good luck my friend.