Getting image link to Sharepoint list picture using Microsoft Graph - sharepoint

Im trying to retrieve some information from a Sharepoint list that contains our Company news. I have looked through our columns that exists and realized that the image is located at a column named PublishingRollupImage.
My call to microsoft looks like this:
https://graph.microsoft.com/v1.0/sites/{tenant id}/lists/posts/items?$expand=fields($select=Title,body,DepartmentCompany,PublishingRollupImage)
BUT - if i make this call, the response will be:
{
"error": {
"code": "-1, Microsoft.SharePoint.Client.ClientServiceException",
"message": "Cannot serialize data for type Microsoft.SharePoint.Publishing.Fields.ImageFieldValue.",
"innerError": {
"request-id": "f885269e-da21-45a0-b3e4-e304f4e01edb",
"date": "2018-12-10T12:12:25"
}
}
}
This is of corse due to that i'm getting the whole image sent by adding this. But i read that i could use .ImageUrl to cast it to a link instead, but i'm not sure if this could be done in a call like this.
Has anyone any pointers to give?

The Object Model(CSOM/JSOM) way return object list but not JSON, so it does not need to serialize. Graph way return JSON, it need serialize operation.
No available workaround for this now, so you may not use the field by Graph now. You could submit one feature request on the UserVoice.

Related

Get value from json in LogicApp

Rephrasing question entirely, as first attempt was unclear.
In my logic app I am reading a .json from blob which contains:
{
"alpha": {
"url": "https://linktoalpha.com",
"meta": "This logic app does job aaaa"
},
"beta": {
"url": "https://linktobeta.com",
"meta": "This logic app does job beta"
},
"theta": {
"url": "https://linktotheta.com",
"meta": "This logic app does job theta"
}
}
I'm triggering the logic app with a http post which contains in the body:
{ "logicappname": "beta" }
But the value for 'logicappname' could be alpha, beta or theta. I now need to set a variable which contains the url value for 'beta'. How can this be achieved without jsonpath support?
I am already json parsing the file contents from the blob and this IS giving me the tokens... but I cannot see how to select the value I need. Would appreciate any assistance, thank you.
For your requirement, I think just use "Parse JSON" action to do it. Please refer to the steps below:
1. I upload a file testJson.json to my blob storage, then get it and parse it in my logic app.
2. We can see there are three url in the screenshot below. As you want to get the url value for beta, it is the second one, so we can choose the second one.
If you want to get the url value by the param logicappname from the "When a HTTP request is received" trigger, you can use a expression when you create the result variable.
In my screenshot, the expression is:
body('Parse_JSON')?[triggerBody()?['logicappname']]?['url']
As the description of your question is a little unclear and I'm confused about the meaning of I am already json parsing the file contents from the blob and this IS giving me the tokens, why is "tokens" involved in it ? And in the original question it seems you want to do it by jsonpath but in the latest description you said without jsonpath ? So if I misunderstand your question, please let me know. Thanks.
Not sure if I understand your question. But I believe you can use Pars Json action after the http trigger.
With this you will get a control over the incoming JSON message and you can choose the 'URL' value as a dynamic content in the subsequent actions.
Let me know if my understanding about your question is wrong.

How do I encode the names of Microsoft group and teams names to include them in an API call URL?

If I have an Office 365 Group/Microsoft Team with the ID "testteam#example.onmicrosoft.com", and I want to query it using one of the beta APIs such as this one, I need to query a URL such as https://graph.microsoft.com/beta/groups/{id}/threads. However, I am stuck on encoding the team name. https://graph.microsoft.com/beta/groups/testteam#example.onmicrosoft.com/threads, https://graph.microsoft.com/beta/groups/testteam#example%2Eonmicrosoft%2E/threads, and https://graph.microsoft.com/beta/groups/testteam#example/threads, https://graph.microsoft.com/beta/groups/"testteam#example"/threads, and https://graph.microsoft.com/beta/groups/"testteam#example.onmicrosoft.com"/threads all return the following error
"error": {
"code": "Request_BadRequest",
"message": "Invalid object identifier 'whatever_I_entered'."
As far as I understand it's just regular URL Encode. For example in JS you may use function encodeURIComponent(str). If you want to try use online URL encoder. For example encoded version of testteam#example.onmicrosoft.com will looks like testteam%40example.onmicrosoft.com and your graph request would be https://graph.microsoft.com/beta/groups/testteam%40example.onmicrosoft.com/threads
EDIT:
In the request you need to use Id of the group. For example: Get Group request may looks like ... and the group id is c28c1cc9-e1ab-4c4d-98d1-d8fdf128b60f
https://graph.microsoft.com/v1,0/groups/c28c1cc9-e1ab-4c4d-98d1-d8fdf128b60f?$select=description,allowExternalSenders

Get usedrange of Microsoft Graph API doesn't work

I am trying to get values that are stored in Excel cells using the method Get usedrange (see the page below), but it doesn't work.
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/worksheet_usedrange
The following error response is returned.
{
"error": {
"code": "InvalidArgument",
"message": "引数が正しくない、不足している、または形式が不適切です。", //The argument is incorrect, missing, or the format is inappropriate.
"innerError": {
"request-id": "dcff76b5-9bc6-4a01-b99f-853b9430ef0d",
"date": "2017-05-01T09:01:15"
}
}
}
I tried GET (as opposed to POST) with the same request URL on a trial ......it is mysterious that sometimes were time out, but sometimes all cell data was returned without timeout (result, the browser hung up).
I'd be very appreciated it if I could get any advise from anyone who encounters the same phenomenon or knows how to avoid it.
--
Additional Notes:
-Excel Data
-Execution result in Graph Explorer (original method, POST)
https://graph.microsoft.com/v1.0/me/drive/items/01PYKTZAO2B65SCU2UDJCKMKFWJEEDRNLQ/workbook/worksheets('Sheet1')/UsedRange()
-Additional Information - Result when use GET in the same URL
The author left a comment saying that they only expected metadata (such as the number of cells), but received all of the data in the range.
You can filter which information you'd like back like so:
/usedRange?$select=columnCount,rowCount,address,addressLocal,cellCount,columnIndex,rowIndex
(Doing this prevents the query from returning the actual data from the cells because it omits things like numberFormat, text, formulas, formulasLocal, formulasR1C1, valueTypes, and values.)

XPages Extlib REST update (HTTP PUT) on calendar event is returning error code (cserror : 1028)

I am trying to update a calendar event in Domino Mail Calendar by using the REST data service "calendar" from the latest xpages extlib release "ExtensionLibraryOpenNTF-901v00_13.20150611-0803".
Has anybody done this with a successful return?
Unfortunately I haven't had any success trying to update a calendar event. I was successful getting the list of events, creating events, deleting an event, but to update an event seems to be somehow special. The PDF documentation for the calendar service is quite short on this point. My domino server is accepting all protocols including PUT. I am using the JSON format for my REST calls. The UPDATE I tried as described in the documentation with iCAL as well, but getting the same error.
I am using the Firefox REST Plugin for checking out the service, before I am implementing it.
Im using PUT, with content-type "text/calendar" as well "application/json".
My URL:
http://sitlap55.xyzgmbh.de:8080/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D
My Body looks like this, which is the easiest event type, a reminder (but I tried it with meeting and appointment as well):
{"events":[{"UID:"4D750E2B8159D254C1257E9C0066D48D","summary":"Ein Reminder update","start":{"date":"2015-08-13","time":"13:00:00","utc":true}}]}
This is how I return the event by a GET:
{
"href": "/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated",
"id": "4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated",
"summary": "Ein Reminder",
"start": {
"date": "2015-08-12",
"time": "07:00:00",
"utc": true
},
"class": "public",
"transparency": "transparent",
"sequence": 0,
"x-lotus-summarydataonly": {
"data": "TRUE"
},
"x-lotus-appttype": {
"data": "4"
}
}
This is the error I get:
{
"code": 400,
"text": "Bad Request",
"cserror": 1028,
"message": "Error updating event",
"type": "text",
"data": "com.ibm.domino.calendar.store.StoreException: Error updating event\r\n\tat com.ibm.domino.calendar.dbstore.NotesCalendarStore.updateEvent(NotesCalendarStore.java:229)\r\n\tat ... 65 more\r\n"
}
The attributes in the body I tried a lot of different things, using the id, no id, an UID like in the calendar service doumentation, ...
What am I doing wrong here?
The solution:
Using the PUT method, the URL which worked looks like this:
http://sitlap55.xyzgmbh.de:8080/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated
the BODY looks like this:
{"events":[{"id":"4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated","summary":"Some Reminder update #6","start":{"date":"2015-08-13","time":"10:00:00","utc":true}}]}
What I figured out was, that the "id" attribute is required ! a bit strange, because it is already in the URL.
I just checked against the documentation for Domino Access Services (DAS) 9.0.1 - and the example they have there actually works.
I tried a few things before that, e.g. if I could PATCH (change individual fields) or PUT (change ALL fields) just specifying the non-system fields. None of these worked. But taking the response from creating (or getting) the event and put it into a PUT request and adjust e.g. start time works fine.
Looking at your example I think the issue is similar as you do not include the end time in the request. But even so you seem to have to include the entire record as it is returned from the service - and please note that the url must end on the ENTIRE id (i.e. including "...-Lotus_Auto_Generated") :-)
/John
Edit:
It seems you don't need to add all fields... But be aware of the side effects of not specifying fields... You need to test it for yourself!

Google YouTube Data API version 3, videoEmbeddable error

I am trying out the youTube Data API v3, on this page: https://developers.google.com/youtube/v3/docs/search/list
Every requests works fine, as long as the videoEmbeddable parameter is left blank. As soon as I set it to true or any, I get a bad request response.
{
"error": {
"errors": [
{
"domain": "youtube.search",
"reason": "invalidSearchFilter",
"message": "Invalid combination of search filters and/or restrictions.",
"locationType": "parameter",
"location": ""
}
],
"code": 400,
"message": "Invalid combination of search filters and/or restrictions."
}
}
Am I missing something?
If you set videoEmbeddable=true, you MUST also set type=video, otherwise you'll get the "Invalid combination of search filters and/or restrictions" error.
I think this is a case where you're dealing with the experimental nature of the v3 API (still in beta, technically). If you look earlier on the page, the videoEmbeddable parameter is no longer listed (nor are parameters such as videoSyndicated, publishedBefore/publishedAfter, etc), and so aren't supported in the actual API, even though the API explorer hasn't been updated to match. Hopefully the API explorer will be brought back into sync soon; until then, you could run your own tests following the API reference.

Resources