Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add property "filesFolderWebUrl" to Model ITeamChannel when calling the Beta graph #902

Closed
1 task done
pmatthews05 opened this issue Jun 28, 2022 · 6 comments
Closed
1 task done
Assignees
Labels
area: model 📐 Related to the core SDK models question Further information is requested

Comments

@pmatthews05
Copy link

Category

  • Domain model extension

Describe the domain model extension

This can only be obtained at the moment using Beta Graph. There is an additional property called 'filesFolderWebUrl' which gives you the SharePoint URL of the channel (Private and Public)
https://graph.microsoft.com/beta/teams/<GroupID>/channels

Model

Model: PnP.Core.Model.Teams.ITeamChannel
Property: FilesFolderWebUrl

APIs

https://graph.microsoft.com/beta/teams/<GroupID>/channels

Additional Information

This is a link to the docs, but this property isn't showing in here.
https://docs.microsoft.com/en-us/graph/api/channel-get?view=graph-rest-beta&tabs=http

But you can see it using the Graph Explorer.
image

@jansenbe
Copy link
Contributor

@jansenbe jansenbe self-assigned this Jun 28, 2022
@jansenbe jansenbe added question Further information is requested area: model 📐 Related to the core SDK models labels Jun 28, 2022
@pmatthews05
Copy link
Author

@jansenbe The suggestion you have offered, is what I'm kind of doing now, (which only worked once I had the nightly build). However, that requires me to loop through each channel, then make the additional call for the getting the URL.

With this new property that is provided in the Beta graph, it would save multiple round trip calls.

@jansenbe
Copy link
Contributor

@pmatthews05 : property has been added, but do note that you need to load each channel as our "let's switch to beta" detection logic only checks for the properties of the loaded model. Luckily you can batch these as shown in below snippet (coming from the test case):

var team = await context.Team.GetAsync(o => o.Channels);

var batch = context.NewBatch();
foreach(var channel in team.Channels.AsRequested())
{
    await channel.LoadBatchAsync(batch, p => p.FilesFolderWebUrl);
}
var errors = await context.ExecuteAsync(batch, false);

foreach(var channel in team.Channels.AsRequested())
{
    if (channel.IsPropertyAvailable(p=>p.FilesFolderWebUrl))
    {
        Assert.IsTrue(!string.IsNullOrEmpty(channel.FilesFolderWebUrl.ToString()));
    }
}

Once the property goes to GA it will be loaded automatically. Alternatively you can force PnP Core SDK to always use the beta endpoint for everything, not recommended for production apps but might work for you. See https://pnp.github.io/pnpcore/using-the-sdk/basics-apis.html#graph-v1-versus-graph-beta for more details.

Closing the issue now, feel free to re-open whenever this still does not work for you.

@jansenbe
Copy link
Contributor

@pmatthews05 : if above is still too slow and you only need the SharePoint URLs for the channels you could also opt to write your own query and parse the returned JSON. See https://pnp.github.io/pnpcore/using-the-sdk/basics-customapirequests.html to learn more.

@pmatthews05
Copy link
Author

@jansenbe you are awesome! Thank you.

I was actually looking for ways of calling custom Graph API early today, didn't see that link you provided. Will the custom Graph calls use Beta if you tell the configuration to use Beta?

So would it be a call similar to?

var apiRequest = new ApiRequest(ApiRequestType.Graph, "teams/{group.id}/channels");
var response = context.Team.ExecuteRequest(apiRequest);

@jansenbe
Copy link
Contributor

@pmatthews05 : you do need to tell to use beta via https://pnp.github.io/pnpcore/api/PnP.Core.Services.ApiRequestType.html#collapsible-PnP_Core_Services_ApiRequestType_GraphBeta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: model 📐 Related to the core SDK models question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants