Sharepoint Document Library OnQuickLaunch (in site navigation) with Graph API? - sharepoint

I'm currently working with SPO and Microsoft Graph API on a .NET 6.0 microservice.
What I want to achieve is to create a Document Library and to have a link to it in the quick navigation on the left.
I can create the Document library successfully like this:
But the created document library is only visible in the "Site Contents" section.
What the user's I'm developing for would like to have is, as simple as: EVERY TIME a new Document Library is programmatically created a link to it SHOWS up in the navigation pane.
From a user perspective this is easily achievable from the UI:
It's just a tick.
With fiddler I saw the body of the request made when you create a Document Library via UI:
But what's the corresponding property of this simple "OnQuickLaunch" field in the Graph API list model?
I've been unable to find any reference from MS documentation, am I blind or missing something?
Would also be ok if should be, somehow, possible to add the link in the navigation pane "manually" from code via Graph API.
Something like:
POST microsoft.graph.com/v1/quickLaunch/links
with body:
{
"name":"myLink",
"url":"the/document/library/url"
}

Related

Display SharePoint Documents Sub Grid on the MS Dynamics 365 form

I have a requirement to display SharePoint Documents Sub Grid on the MS crm Dynamics 365 Custom Entity Form.
Can anyone let me know, how to achieve this using Supported or unsupported way?
You can find solution here:
You may use the below line of code to set the Iframe url to display the subgrid in iframe:
Xrm.Page.getControl("IFRAME_Documents").setSrc(Xrm.Page.context.getClientUrl() + "/userdefined/areas.aspx?formid=" + CurrentFormId + "&inlineEdit=1&navItemName=Documents&oId=%7b" + recordId + "%7d&oType=" + oTypeCode + "&pagemode=iframe&rof=true&security=852023&tabSet=areaSPDocuments&theme=Outlook15White");
Where:
“IFRAME_Documents” is the Iframe name.
“CurrentFormId”= Is the Current selected form id which you can get using Xrm.Page.ui.formSelector.getCurrentItem().getId().replace("{", "").replace("}", "");
“recordId” = Record’s GUID
“oTypeCode” = Entity Type Code which you can get using Xrm.Page.context.getQueryStringParameters().etc;
This is how I did in D365. (Using Chrome made it easier)
Enable document management for the entity
When Documents tab shows
for the entity record open it.
Then open Chrome dev console (F12)
Grab the panel (which is actually an iframe) source. The URL is of format:
/userdefined/areas.aspx?appid=...........&formid=.......&inlineEdit=1&navItemName=Documents&oId=.....&oType=.....&pagemode=iframe&rof=true&security=......&tabSet=areaSPDocuments&theme=Outlook15White
Replace the dotted values in the source URL with appropriate values
and make the URL fully qualified prefixing with the root.
Just ensure not using any hardcoded GUIDs or IDs in the values. In this way this can be reused easily wherever needed.
Latest: Recent version has direct OOB customization to achieve this.
Dynamics 365: Related Documents Now Display on Record’s Main Form
Add or remove the SharePoint documents tab to the main form for any table
In short: Server to Server integration approach shows physical documents in crm grid. No need of iframe solution.
Old school List component integration has a limitation, it shows document location crm records in crm grid, so you need iframe solution to show physical docs from Sharepoint.
[Applicable to Server based Integration] - It will show Documents in the grid.
Open an Entity Web form where you want to display SharePoint document library.
Click on the Insert-tab, click on Sub-Grid, specify a name to sub-grid
In “Data Source” section select “Only related Records” from Records dropdown
Select “Document Location (Regarding)” in Entity dropdown
Select “Active Document Location” from Default View section [shown in Below Image]
Click on Set. Click on save then publish the customization
Reference
Update: [Applicable to List component Integration]
Associated view will show what we want but subgrid is not working as expected. Upon research, this is product limitation. Read more
sometimes it is desirable to have an “at a glance” view of documents associated with a record. In order to view the documents in SharePoint that are related to a record, the user must navigate to a related entities area outside of the form. (Similar to Connection, or other related entities)
For most related entities, a sub-grid can be used in the form to display the relationships immediately on the form, but there is no simple workaround for the Documents.
Another alternative is showing Associated view in IFRAME.
EDIT:
In latest Dynamics 365, CRM + Sharepoint integration using List component is deprecated. Only way is Server to Server (S2S) based CRM + Sharepoint integration is possible. This S2S approach shows documents in the associated grid & subgrid, not the doc location like in List component. CRM - Sharepoint wrapper taking care of conversion from CRM FetchXML to SP CAML query & give us the result we want.
The great thing about having the documents queried by CRM is that you
can create custom views of documents in the same way you would with
any other entity in CRM. When using the list component the default
view in SharePoint was rendered in the IFRAME meaning that to get new
columns you had to have list customisation privileges on SharePoint
such that all users would see the changes. With the new server to
server integration you can select SharePoint columns to include in
your own views and even add in your own filters using the CRM advance
find interface.
Read more.

Access files of Document Library site through Microsoft Graph API

I was wondering if the two following queries are actually the same or supposed to be the same:
GET https://graph.microsoft.com/beta/sharepoint/sites/{spsite-id},{spweb-id}/drives
and
GET https://graph.microsoft.com/beta/sharepoint/sites:/MYPATH:/drives
I would like to access a Document Library Item in a sharepoint site through the relative path.
Please mind that both endpoints below are the same for getting all doc libraries or drive in a site according to the current beta microsoft graph documentation. The latter becomes handy when you dont know the site id yet but the relative site url.
https://graph.microsoft.com/beta/sites/[domain.sharepoint.com]:/[relative-url]:/drives
https://graph.microsoft.com/beta/sites/[site-id]/drives
(e.g. site id: "cie493742.sharepoint.com,4af352a7-a53b-43d9-b0a3-da372b392ea0,52c490f3-3354-40b9-a3c9-fefb08cb5c88" )
Now to get the document library item
Get Document library id from list of drives
https://graph.microsoft.com/beta/sites/[site-id]/drives
Get item id from list of items
https://graph.microsoft.com/beta/sites/[site-id]/drives/[drive-id]/items
Final API call
https://graph.microsoft.com/beta/sites/[site-id]/drives/[drive-id]/items/[item-id]
you could try experimenting the Graph API from here

Does Application Insights track referrer url?

I think I looked and searched everywhere but I could not find any charts or report with referrer traffic data. I am using the newest version that stores data in the preview Azure portal. In the old Application insights (that was in VS Online) had this data.
Does anyone know if and where it can be found in the new portal?
Thanks in advance!
We don't have a native support for url referrer yet. As a workaround you could add a custom property to each JS SDK api call you need (like trackPageView). You'll have to set the property value yourself. I checked that this works:
appInsights.trackPageView(null, null, {urlReferrer: document.referrer});
First two nulls make us to set page name and url automatically. 3rd parameter is a custom properties object.
Then you'll be able to group by "urlReferrer" in the portal.
There is a property called "Page view referral url base" that you should be able to segment the chart or grid of page views.
In the Metric Explorer, Add a chart => Select Page View Metric => Turn Grouping On => select Page view referral URL base.

Set field via URL

Is it possible to have a field in the current item be changed by clicking a URL? The field would be a choice field with predefined choices.
Such as if the item field is currently:
Status: 2
If a user clicks the link, the field would now be:
Status: 3
If not, is there any other way for a user to easily change a field in the current item without actually haveing to visit the item?
Thanks!
Not Out Of The Box (OOTB) - but you've a few options.
Write an ASPX page to do what you want
Use something like SPServices and javascript to update the list item via the web services.
Use the Client Object Model (2010 only)
By the way - changing stuff on a 'get' can be dangerous as you can do malicious things - for example imagine you have a page that deletes the users account without any prompting (exact example doesn't matter) - what if someone clicks on that link by mistake or even worse what about an email sent with an image with that page as source URL - simply viewing the email could delete the users account.
It's not possible by using a GET request, but SharePoint 2010 is offering a RESTful API to manage ListItems from any client
The REST API is located within the virtual WebServices folgder under each SharePoint Site.
http://YourSharePointSite/_vti_bin/ListData.svc.
To perform an update on SharePoint ListItems you have to create a PUT Request. For more information on SharePoints REST API you should have a look at this MSDN site, there are also a lot of samples linked from this article.
Thorsten

Passing data to html web resource via code, crm 2011

I've put an html web resource on my contract form and would like to pass via the data= parameter some information that comes from a plugin that is registered for PostRetrieve. I know how to set static info for the web resource, but I can't find in the SDK how to set it dynamically from a plugin. Is this possible?
Background info
I'm new to developing for CRM so it's quite possible that I'm not taking the most effective route in building this project. Let me give you some more detail: when a contract is opened in CRM, my plugin retrieves some business information from a different sql server and fills in a few of the contract fields. This is working fine. However, I would also like to display a table of usernames and links that come from the remote sql server on the crm contract form. Because I did not want to save this info in the contract entity and because there are links I want the user to click on, I thought a web resource displayed on the form was the best implementation.
My thought was to pass all the data to the web resource via the data= parameter and then parse and build a table using javascript in the web resource.
What seemed to work best:
The plugin retrieves the info from the remote sql server, serializes the generic list to json and puts it in a hidden text field on the form.
The html web resource gets the content of the hidden field, does an eval, and builds a table.

Resources