msgraph-sdk-dotnet
msgraph-sdk-dotnet copied to clipboard
Hyperlink or Picture property of Column Definition is null
Problem When trying to get column definition by Id, via GET: ...sites/{siteId}/Lists/{listId}/columns/{columnId}, the response object the property "HyperlinOrPicture" (which indicates the data type of the column) comes as null even though this column is configured as hyperlink. The same happens if I'm trying to push/update the value of that column. It doesn't work, even though I get no errors. It seems like the SDK is ignoring this property.
I am currently using Microsoft.Graph v4.10
To Reproduce
- Create a sample/test column within a list in SharePoint and set its data type to Hyperlink or Picture
- Create a sample app and set up a graph client with an auth provider (maybe using MSAL for .net)
- Try getting the column definition you just created, either by using sites/{siteId}/columns/{columnId} , or explicitly specifying list id: sites/{siteId}/lists/{listId}/columns/{columnId}
- Check for ColumnDefinition.HyperlinkOrPicture property (mine is always null)
Expected behavior If the column definition data type is set as Hyperlink, then the facet (property) "HyperlinkOrPicture" should not come null. It should contain information about this specific data type
Desktop:
- OS: Windows 10
- Browser Chrome
Hey @genchani,
I notice that the default response does not have this property in it.
Are you able to view the property when you run a query like this?
https://graph.microsoft.com/v1.0/sites/root/lists/{listId}/columns?$select=hyperlinkOrPicture
Hi @andrueastman,
While I was trying the query you mentioned (and mine as-well), I noticed a weird behaviour.
When I'm using Postman to test the query, the property is coming as expected within the response, however, when I use graph explorer, the property is not coming. In this case, I am assuming this could be happening because of the different access tokens that I am using (graph explorer uses delegated permissions, while in postman I am using application permissions).
After this, I also tried to test the same query using the graph SDK but with application-level token this time, however, it is still not working.
In those scenarios, are you querying for the exact same object with the same ids?
From the docs, the property is mutually exclusive to other properties and will depend on the object itself.
https://docs.microsoft.com/en-us/graph/api/resources/columndefinition?view=graph-rest-1.0#properties
Yes, I am querying the same exact object with the same Ids in both ends, but I am getting different results.
Thanks for the extra info @genchani.
Are you able to extract the tokens and compare the scopes present in two cases by decoding them at https://jwt.ms/? Also, is there any difference if you change from beta or v1.0 endpoints?
Here is a screenshot of both tokens decoded side by side. On the left is Postman Token and on the right is Graph explorer token. As you can see, the postman token doesn't contain Identity information, while graph explorer has them (which comes as a result of authenticating on behalf of the user)
Also, there is no difference between beta and v1.0 endpoints. In postman calls, they both return hyperlink property.
Hey @genchani,
Sorry, but for some reason I'm not able to access the link to your screenshot. Any chance you could verify it's okay and maybe resend it?
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
Hi again @andrueastman, sorry for the delay.
The image is opening just fine on my end. Anyways, I have uploaded the same image on my personal drive as well. Here it is
Hey @genchani,
Thanks for the information. I notice both tokens contain the Sites.ReadWrite.All
permission which is consistent with the docs. When obtaining the application token for Postman, do you use the same method/flow for token acquisition as the method used in the SDK when using app permissions?
Hi @andrueastman Within our application, we were acquiring App-level tokens by using Client Credentials Flow (using client secret). The same goes for Postman, we use client credentials there as well.
Bump
@genchani @wiznotwiz Any chance this is still an issue?
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.