Microsoft graph patch content to excel online ,but all rows are empty - microsoft-graph-api

i am trying to patch content to a excel file, but nothing appears, not sure why.
patch https://graph.microsoft.com/v1.0/drives/drivesID/items/ItemId/workbook/worksheets/Sheet1/range(address='A1:W1083')
,
the json object is https://pastebin.com/embed_iframe/g51xBUHp

Finally I found the problem, so the data posted to excel online can not be {} json data, meaning, no key referenced, so the data must use array_values() to extract, and then patch.
Referecning stackoverflow question!

Related

Code by Zapier - Input data field losing information when trying to execute code

I am using code by zapier, javascript.
I've used before and never had problems.
But today, as I am trying to create a new zap, I am reading data from trello and then trying to process the data with code by zapier.
I am filling data coming from trello in the field "Input Data", and then, trying to read the input data in my code using:
var cards = inputData['cards'].split(",");
The problem is that when I test the code, I receive an error:
TypeError: Cannot read property 'split' of undefined
When I go to check the Input Data field, it is losing the information.
Even if I type again, the Input Data information is not storing what I am asking there.
Any ideas?
Thank you
Amanda
Thank you everyone. I haven’t changed a thing.
I’ve tried in the next day with the same zap and that initial code that I posted.
Zapier was cleaning out the field with the data input from Trello (wasn’t detaining the value to pass to the next step).
Now it’s working. As I tried with different browsers on the same day and it was equally not working, I believe it was a bug that was fixed.

Get message using Graph missing some InternetMessageHeaders

When i get mail message from o365 Graph using
https://graph.microsoft.com/v1.0/users/XXXX#xxx.xx/messages/?$select=InternetMessageHeaders
Not all headers is present in result. I´m missing From, To and CC.
Same result in graph SDK for .net
Looking at same mail in OWA view original shows From and To as headers.
Anyone else has this problem, or is this expected? I just has a feeling i have seen this headers in this result, but i´m not at all sure.
I don't know the reasoning behind it but the Graph doesn't return all the header properties when you use InternetMessageHeaders prop. If you want all the headers you need to use the PidTagTransportMessageHeaders extended property https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagtransportmessageheaders-canonical-property which will show you what you see in Outlook (you will need to parse it yourself though)eg
https://graph.microsoft.com/v1.0/me/MailFolders('Inbox')/messages('...=')?$select=InternetMessageHeaders&$expand=singleValueExtendedProperties($filter=id eq 'String 0x007D')

Microsoft Graph OneNote Patch API removes images after Patch

I am replacing a table content in a OneNote Page by using the PATCH API. In order to do so, I call content API with includeIds option.
Following is an example URL.
https://graph.microsoft.com/v1.0/groups/<id>/onenote/pages/<page-id>/content?includeIds=true
If the table has some images the response of the get with ids looks like this
<img id="img:{cdbee0cc-a1d6-4a42-93f8-e4ff7babab92}{28}" width="480" height="147" src="https://graph.microsoft.com/v1.0/groups('id')/onenote/resources/<page-id>/$value" data-src-type="image/png" data-fullres-src="https://graph.microsoft.com/v1.0/groups('id')/onenote/resources/<page-id>/$value" data-fullres-src-type="image/png" />
After the content returns I modify the part of the table and do a PATCH request.
After the PATCH the image is replaced with a cross sign. Because the URL that is returned is a secure URL and As per the OneNote API the images that we can insert/replace should be either public resources or embedded.
In my case want to keep the the original image with in the table I only want to replace other parts of the table. Is there any work around to solve this problem?
According to the OneNote API (https://learn.microsoft.com/en-us/graph/onenote-update-page#supported-elements-and-actions) you cannot. You can only update image within a div, but you want to update img within a table
As per this documentation, update actions within a table cell are not supported. One more implication of updating elements within a table using PATCH request is that it may mess up with the table structure.
https://learn.microsoft.com/en-us/graph/onenote-update-page#supported-elements-and-actions
When you make you Graph request, you should be able to go to Response Headers>client-request-id. Can you please provide the id that you see there, as well as the time/date that you made the request? Please make sure the time/date is within the past 2 weeks.
Thank you

How to get a note or comment

I have an Excel containing cell comments/notes, I've uploaded it to Google Drive, and converted it into a Google Spreadsheet. How may I retrieve the comments for cell A1?
The API doesn't describe how to get a note or comment from a cell.
The Google Apps Spreadsheet API only provides programmatic access to spreadsheet data. You cannot access comments using the API.
You can get the Notes for a cell or range of cells using Google Apps Script. See the Class Range documentation for these methods:
getNote() - Returns the note associated with the given cell.
getNotes() - Returns the notes associated with the cells in the range.
There are open issues related to this functionality, mainly concerning comments (the "other" type of note). See Issue 1818 and Issue 2566
In a comment on your question, SGC asks if you've looked at developers.google.com/drive/v2/reference/comments/get and developers.google.com/drive/v2/reference/comments/list; these are FILE level comments, not the comments attached to a spreadsheet cell.
1 - Add the following custom function to your spreadsheet (through the Tools -> Script Editor menu)
function getNote(cell) {
return SpreadsheetApp.getActiveSheet().getRange(cell).getComment()
}
2 - on your spreadsheet use the following formula to get contents
=getNote(cell("address",a1))
or
=getNote(cell("address",E9),GoogleClock())
if your comments are not static.
Bit of a muck around but it's possible to download the googlesheet as a .xlsx file, which, with varying degrees of success, converts the comments into Excel comments.
Uploading this xslx file converts the comments to notes!
There is a difference between Note and Comment.
getNote is working fine. You create a Note by using the cell menu "insert Note" , and not "insert Comment"
Very sad, but there is no getComment. The example of Oren did not work for me either.

ASP.net MVC Export To Excel

I am currently exporting to Excel using the old HTML trick, where I set the MIME type to application/ms-excel. This gives the added benefit of nicely formatted tables, however the negative of the excel document not being native Excel format.
I could export it as CSV, but then this would not be formatted.
I have read brief snippets that you can export it as XML to create the Excel document, but cannot find too much information on this. Does anybody know of any tutorials and/or benefits of this? Can it be formatted tables using this method?
Thanks.
Easiest way, you could parse your table and export it in Excel XML format, see this for example: http://blogs.msdn.com/b/brian_jones/archive/2005/06/27/433152.aspx
It allows you to format the table as you whish (borders, fonts,colors, I think even formulas), and Excel will recognize it as native excel format. As a plus, you can use other programs that can import Excel XML (ie.Open office, Excel viewer,etc) and you do not need to have Office components installed on the server.
Check out ExcelXmlWriter.
We've been using it for some time and it works well. There are some downsides to the xml format however. Since it's unlikely your end users will have the .xml extension associated with Excel, you end up having to download files as .xls with an Excel mime type. When a user opens a file downloaded in this way they get a warning that the file is not in xls format. If they click through it, the file opens normally.
The only alternative is a paid library to generate native Excel files. That's certainly the best solution but last time we looked there were no good, free libraries (may have changed)
Bill Sternberger has blogged a very simple solution here:
export to excel or csv from asp.net mvc
Just today I had to write a routine that exported data to excel in an MVC application. Here's the details so someone may benefit in the future, first the user had to select some date ranges and areas for the report. On the post back, this method was in place, with TheModelTypeList containing the data from LINQ/Entity Framework/SQL Query returning strong types:
if (ExportToExcel) {
var stream = new MemoryStream();
var serializer = new XmlSerializer(typeof(List<SomeModelType>));
serializer.Serialize(stream, TheModelTypeList);
stream.Position = 0;
FSR = new FileStreamResult(stream, "application/vnd.ms-excel");
}
The only catch on this one was the file type was not known when opening so the system prompted for the application to open it... this is a result of the content being XML.... I'm still working on that.
I am using Spreadsheet Light, an Open-Source library that provides ridiculously easy creation, manipulation and saving of an Excel sheet from C#. You can have an MVC / WebAPI Controller do the work of creating the file and either
Return a URL link to the saved Excel file to the page and invoke Excel to open it with an ActiveX object
Return a Data Content Stream to the page
Return a URL link to the calling page to force an Open / Save As dialog
http://spreadsheetlight.com/

Resources