Microsoft Graph OneNote Patch API removes images after Patch - microsoft-graph-api

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

Related

Retrieving More columns as Part of VSTS query

I'm trying to fetch details from VSTS using VSTS query API. So to get all Portfolio Epics I created a custom query and used its ID to get that in JSON format. the query looks like this
https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/wiql/{id}?api-version=5.0-preview.2
But the issue is its not giving me many details about each of the work items in JSON. It only lists the ID and URL. Like this
WorkItems:[
{ID:234,URL:"workitemurl"},
{ID:235,URL:"workitemurl"},
{ID:236,URL:"workitemurl"},
...
]
So if I need more details about an item I need to execute those individual URl for each PE and thus I can get its details. instead of I am just checking is there is any way of getting an ID (keyedinID of each work item along with the ID and URL) like this. Please note KID is a field if we execute the URL separately. So to avoid that extra process, I would like to get that along with the WorkItems.
WorkItems:[
{ID:234,URL:"workitemurl",KID:002},
{ID:235,URL:"workitemurl",KID:023},
{ID:236,URL:"workitemurl",KID:033},
...
]
So how can we make this possible?
The Web UI uses a different API to get query results (/_api/_wit/_query), which allows query+data in a single pass. This is an old __v5 type call, which means it's considered internal.
The proper way to do this now is to first do the query as you're doing it right now and then call /_api/wit/workitems?ids=1,2,3,4 using the IDs from the references you got from the first call. That will also allow you to load the details dynamically and in small batches which will result in a more responsive UI.
See:
https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/list?view=azure-devops-rest-4.1

Is it possible to get all items using get_internal?

I have a need to be able to retrieve all items for a particular resource via a custom route. when I use the function as such get_internal("users", **{"role": item["_id"]}) I am only able to retrieve 50 users. Is there a way to tell get_internal to get all matching items? even if the number of items exceeds the PAGINATION_DEFAULT setting? Also is there any documentation on the <method>_internal functions?
Please see PAGINATION_LIMIT, PAGINATION_DEFAULT and QUERY_MAX_RESULTS. (Sorry, links only highlight the words in the page)

Google Spreadsheet getting text with importxml

I've tried this and other versions to no avail? Can anyone help please?
=IMPORTXML("http://performance.morningstar.com/fund/ratings-risk.action?t=MWTRX", "//*[#id='div_ratings_risk']/table/tbody/tr[4]/td[3]/text()")
As explained in the comments to your original question, initially the div Element with the id #div_ratings_risk is initially empty and does not consist of a table.
So Google spreadsheets is not able to parse content that is not there and yet needs to be loaded first.
The content (table) you try to fetch data from into your google spreadsheet is dynamically loaded using jQuery from another URL. You can get that URL using e.g. the chrome developer tools and filter for XHR request.
If you parse the content directly from that HTML it will work. So you would need to change your formula to that URL and adapt your XPath like so:
=IMPORTXML("http://performance.morningstar.com/ratrisk/RatingRisk/fund/rating-risk.action?&t=XNAS:MWTRX&region=usa&culture=en-US&cur=&ops=clear&s=0P00001G5L&ep=true&comparisonRemove=null&benchmarkSecId=&benchmarktype=", "//table/tbody/tr[4]/td[3]/text()")

Updating autorout URL from C# code in ORCHAD CMS

I have built a simple website and have the requirement to display all post from a blog for a year.
For example www.mysite.com/blogs/2015 should display all posts of 2015.
However, this year is not the real creation date of the post but it is given as input while creating the post (I have added new field to the editor).
I should also have a way to access a post with a unique URL like www.mysite.com/blogs/2015/2, which should display the second post of 2015.
The post number is unique for the year. So I cannot use the content id.
I was able to make this work with my own controller, but an issue remains:
When posts are listed it will attach the URL created by the AutoroutePart, which will be like www.mysite.com/blogs/first-post.
I attempted to change this URL while creating the post by updating the Path property of the AutoroutePart but had no luck.
Any suggestions or advise are appreciated.
You can define you own route for any content item which has the AutoroutePart.
Example in you situation you need to edit the content definition of the blog posts. So under the Content Definition menu you select Blog Post, then edit, then you click on the expando arrow next to the Autoroute label and you'll see the Patterns field where you can define your own pattern.

Manipulating SurveyMonkey Results & data

we wud like to webscrape / import surveymonkey results into a html page then approve/decline each survey from/on that page.
We can also use wordpress as a last resort if we must.
Any ideas/tip how we can do this programatically ? Api Tips ???
Tnx
You can use the SurveyMonkey API to fetch the responses and render them how you like.
You can fetch the survey details like this:
GET /v3/surveys/<survey_id>/details
You can fetch the survey responses like this:
GET /v3/surveys/<survey_id>/responses
You can then join the two data together to fill it out. This may be quite a bit of work to render all that yourself though, you may just want to have a list of edit/analyze URLs (provided in the body when fetching responses) and then click through to SurveyMonkey to view the response and decide.
Fetch them in bulk like this:
GET /v3/surveys/<survey_id>/responses/bulk
and make a table with a list of URLs to work with. You may think of other ideas by looking at the API docs.

Resources