msgraph-sdk-dotnet icon indicating copy to clipboard operation
msgraph-sdk-dotnet copied to clipboard

Hyperlink or Picture property of Column Definition is null

Open genchani opened this issue 3 years ago • 12 comments

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

  1. Create a sample/test column within a list in SharePoint and set its data type to Hyperlink or Picture
  2. Create a sample app and set up a graph client with an auth provider (maybe using MSAL for .net)
  3. 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}
  4. 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

genchani avatar Nov 24 '21 00:11 genchani

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

andrueastman avatar Dec 01 '21 08:12 andrueastman

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.

genchani avatar Dec 01 '21 12:12 genchani

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

andrueastman avatar Dec 01 '21 13:12 andrueastman

Yes, I am querying the same exact object with the same Ids in both ends, but I am getting different results.

genchani avatar Dec 01 '21 13:12 genchani

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?

andrueastman avatar Dec 01 '21 13:12 andrueastman

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.

genchani avatar Dec 01 '21 14:12 genchani

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?

andrueastman avatar Dec 03 '21 06:12 andrueastman

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.

ghost avatar Dec 07 '21 07:12 ghost

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

genchani avatar Dec 07 '21 17:12 genchani

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?

andrueastman avatar Dec 15 '21 05:12 andrueastman

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.

genchani avatar Dec 17 '21 13:12 genchani

Bump

wiznotwiz avatar Aug 26 '22 20:08 wiznotwiz

@genchani @wiznotwiz Any chance this is still an issue?

andrueastman avatar Aug 17 '23 08:08 andrueastman

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.