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

File/Folder/ListItem sharing commands #3996

Open
6 of 12 tasks
MathijsVerbeeck opened this issue Nov 3, 2022 · 28 comments
Open
6 of 12 tasks

File/Folder/ListItem sharing commands #3996

MathijsVerbeeck opened this issue Nov 3, 2022 · 28 comments

Comments

@MathijsVerbeeck
Copy link
Contributor

MathijsVerbeeck commented Nov 3, 2022

Using the Graph API, we are able to share files, folders or listitems with users using various ways:

  • Organizational links
  • Anonymous links
  • Specific User link
  • ...

In my opinion, it would be nice if we could list the sharing links of a specific file, folder or listitem and have the capability of sharing a file, listitem or folder using a link or update existing shares.

What do you think about this? Does this sound like a good idea? If so, I could make a list of all the possible commands and the properties that could be passed to these commands.

More documentation about sharing files using Graph API can be found on the following link: https://learn.microsoft.com/en-us/graph/api/resources/permission?view=graph-rest-1.0

Tasks

File

Folder

@milanholemans milanholemans added needs design needs peer review Needs second pair of eyes to review the spec or PR feature request labels Nov 3, 2022
@milanholemans
Copy link
Contributor

Hi @MathijsVerbeeck
Looks like a great enhancement to me for the CLI!
This means that we'll be creating 5 commands (list, get, add, update, delete) for each resource type (file, list item, folder) right?

@pnp/cli-for-microsoft-365-maintainers what are you thoughts?

@Adam-it
Copy link
Contributor

Adam-it commented Nov 3, 2022

Hi @MathijsVerbeeck Looks like a great enhancement to me for the CLI! This means that we'll be creating 5 commands (list, get, add, update, delete) for each resource type (file, list item, folder) right?

@pnp/cli-for-microsoft-365-maintainers what are you thoughts?

@MathijsVerbeeck great suggestion as always 🤩🤩
Small open points from my side:

  • What about Add users to sharing link? Will we have also a dedicated command for it? or we are planning to start with the first 5?
  • those endpoints should work for SPO and OneDrivce, but in CLI we have these as separate namespaces. Do we plan to start with SPO first and see if they might be reused as aliases? or the other way around? We should be aware that some properties apply only for OneDrive 🤔

@MathijsVerbeeck
Copy link
Contributor Author

  • What about Add users to sharing link? Will we have also a dedicated command for it? or we are planning to start with the first 5?

I think that we should create a seperate command for this, as it is possible to add users and remove existing users at the same time. Using the default 'update' command could be hard to implement this here. I'm not sure on the amount of commands, but I'll list that once you folks say 'Go'! I will have to do some reasearch, as it is also possible to add / remove roles, but we have to think about how we decide if we keep the existing ones or go 'from scratch'.

  • those endpoints should work for SPO and OneDrivce, but in CLI we have these as separate namespaces. Do we plan to start with SPO first and see if they might be reused as aliases? or the other way around? We should be aware that some properties apply only for OneDrive 🤔

I think that we should indeed make a separation between SPO and OneDrive, as also this will differ between how to create the sharing link (sites/{siteid}/drive/items/{itemid} and /users/{userid}/drive/items/{itemid}). I think that otherwise, the options will become too difficult to comprehend and we will have to do too many checks.

A lot of the code for creating the specific request objects will however be able to be re-used, so we will be able to reuse a lot of the code over the two commands.

@milanholemans
Copy link
Contributor

Looks good to me 👍
I'd say let's make a list of all commands, after that we can start making issues.

@Adam-it
Copy link
Contributor

Adam-it commented Nov 4, 2022

Looks good to me 👍 I'd say let's make a list of all commands, after that we can start making issues.

I agree

@milanholemans
Copy link
Contributor

milanholemans commented Nov 5, 2022

We might also introduce a command to clear all sharing links of a file, folder, ...

That way we can also tackle #3729

@MathijsVerbeeck
Copy link
Contributor Author

I did mean to include that in the commands. I'll try my best to write down a list of possible commands tomorrow for the spo file commands.

@MathijsVerbeeck
Copy link
Contributor Author

MathijsVerbeeck commented Nov 6, 2022

For the spo file commands, this would be the following (please not that the value in functionality is not equal to the later description, but just to give an idea):

Command Functionality
spo file sharinglink list Lists the sharing links of a file. Will return the sharing links
spo file sharinglink get Get a specific sharing link of a file. Will return the sharing link object
spo file sharinglink add Creates a sharing link to a file. Will return the sharing link object after creation
spo file sharinglink set Updates the sharing link. Possible options are: expiration, permissions, people that the file is shared with (if not anonymous), .... Will return the sharing link object after updating
spo file sharinglink remove Removes a specific sharing link. Will return nothing
spo file sharinglink clear all sharing links from the specific file. Will return nothing

What are your opinions about this?

@milanholemans
Copy link
Contributor

milanholemans commented Nov 6, 2022

Looks good, only remark, sharinglink update should be sharinglink set.
And sharinglink delete --> sharinglink remove
I think you can start creating these issues and spec them 🚀

@MathijsVerbeeck
Copy link
Contributor Author

Just one more question: I wonder, for this specific scenario, if it would be useful to use the Beta Graph API, as this is much more extended regarding the use and creation of sharing links. Currently, using the 1.0 API, we cannot for example create user sharing links, but only anonymous or organizational. What is your opinion on this? I'll currently create the specs using the Graph API V1.0, but I can change them obviously later.

@milanholemans
Copy link
Contributor

I'd say let's use v1.0 to create anonymous or organizational links and perhaps we can use the beta version to create user sharing links. Would that work?
If we do this, let's ensure that we add a warning to the docs that the API is in preview and subject to change.

@milanholemans
Copy link
Contributor

@MathijsVerbeeck could you add a reference to all created issues so they are linked to this epic issue?

@milanholemans milanholemans added feature request and removed needs peer review Needs second pair of eyes to review the spec or PR labels Nov 9, 2022
@arjunumenon
Copy link
Member

arjunumenon commented Nov 9, 2022

Pardon me for coming super late to the discussion.
Loved the idea @MathijsVerbeeck ❤️.

Just that I am a doubtful on the naming though - though we are dealing with sharing links type, but would that name be understandable for the normal user? I doubt so.
For a user, in my opinion all it matters is sharing. So that being the case, my personal opinion is to have the command to be something like spo file sharing list.
A question though - Link sharing is the only way to add the users via Graph API right? You can do direct user addition via UI, but through API it is not possible right?

@MathijsVerbeeck
Copy link
Contributor Author

Just that I am a doubtful on the naming though - though we are dealing with sharing links type, but would that name be understandable for the normal user? I doubt so.
For a user, in my opinion all it matters is sharing. So that being the case, my personal opinion is to have the command to be something like spo file sharing list.

I don't mind the name of the command. This can always change if you guys think that it is clearer if it is spo file sharing ....

A question though - Link sharing is the only way to add the users via Graph API right? You can do direct user addition via UI, but through API it is not possible right?

Currently, using the V1.0 api, it indeed is impossible to grant / revoke permissions to an existing sharing link. However, using the beta API, this is possible. This is why I suggested using this earlier.

@milanholemans
Copy link
Contributor

milanholemans commented Nov 9, 2022

Just that I am a doubtful on the naming though - though we are dealing with sharing links type, but would that name be understandable for the normal user? I doubt so.
For a user, in my opinion all it matters is sharing. So that being the case, my personal opinion is to have the command to be something like spo file sharing list.

I'm not convinced of spo file sharing list, in the Graph docs this is also called sharing links. In the SharePoint UI these are are called links under the sharing button. To me it's quite clear what a sharing link is. Also sharing is not really a noun. But maybe let's see what others think of it.
@pnp/cli-for-microsoft-365-maintainers

@Jwaegebaert
Copy link
Contributor

I'm also a fan to follow the Graph docs naming spo file sharinglink

@Adam-it
Copy link
Contributor

Adam-it commented Nov 11, 2022

great work everybody. I know the issues are already created 😉 but just to confirm the sharinglink seems ok for me 👍

@martinlingstuyl
Copy link
Contributor

Looks great @MathijsVerbeeck! 👏

@waldekmastykarz
Copy link
Member

Is there a specific reason these commands have to be in the spo namespace rather than directly in the file namespace? As we're not depending on SharePoint APIs, I'd be for including them in the file workload.

@Adam-it
Copy link
Contributor

Adam-it commented Nov 22, 2022

@milanholemans @Jwaegebaert @MathijsVerbeeck lets recheck/refresh this one and reconsider @waldekmastykarz last comment 😉

@milanholemans
Copy link
Contributor

Sorry totally missed this one. I assume it's all sorted out since Waldek opened up the issues and they are already implemented? Anyway for me spo seems to be the most logical since we only take SPO files into account?

@waldekmastykarz
Copy link
Member

waldekmastykarz commented Jan 12, 2023

Aren't all files on M365 stored on SPO (especially, if we consider that OneDrive for Business is built on top of SharePoint sites)? We typically use the spo namespace to designate the dependency on SharePoint APIs. For other things, that are expressed on Graph, we use namespaces that are closer to the namespaces on Graph.

@milanholemans
Copy link
Contributor

Aren't all files on M365 stored on SPO (especially, if we consider that OneDrive for Business is built on top of SharePoint sites)?

Essentially yes, but in this case we are creating an SPO command and an OneDrive command because in OneDrive we can set additional options for sharing links which only work on OneDrive personal sites.

@waldekmastykarz
Copy link
Member

So onedrive file sharinglink ... and spo file sharinglink ...?

@milanholemans
Copy link
Contributor

So onedrive file sharinglink ... and spo file sharinglink ...?

That was the idea yes.

@waldekmastykarz
Copy link
Member

Perfect, so commands listed in this epic are specific to spo and then we'll create a separate epic with onedrive commands?

@milanholemans
Copy link
Contributor

Was planning to add them all to this epic, but if you want multiple epics, we can do that as well.

@waldekmastykarz
Copy link
Member

Ah cool, we can add them here as well. The name of this epic is broad enough to accommodate them both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants