Cli-microsoft365: Update spo field remove to remove all field in a given group

Created on 3 Mar 2020  路  16Comments  路  Source: pnp/cli-microsoft365

Usage

spo field remove --webUrl https://contoso.sharepoint.com/sites/contoso-sales --group MyGroup

Description

Above command would remove all filed that are in the group MyGroup

enhancement feature request work in progress

Most helpful comment

@waldekmastykarz ahh... now I got it.

Would it be possible to subscribe to waldekAsADebuggingService? :)

Just pushed the changes for review

All 16 comments

Nice suggestion! 馃憦

@waldekmastykarz assign it to me

Appreciate your help! All yours!

Hey @plamber, are you still working on this?

Have not started yet unfortunately. Planned to do it asap. Same holds for the other assigned tasks

@waldekmastykarz

In this specific case I have two solutions how to retrieve the site URL coming from the GroupId. I can use the Graph API using https://graph.microsoft.com/v1.0/groups/$groupId/sites/root/weburl or I could use the hidden list in the SharePoint Online admin catalog to retrieve the URL by filtering it using the GroupId.

I prefer using Graph in this case. This requires me to write some code in Graph not directly related to a command. The authentication is therefore failing.
What is the best approach to merge two operations that have different authentication requirements? Do we have already something else running?

Thank you,
Patrick

I think the idea behind this command was to remove all fields belonging to the specified field group, not an Office 365 group. 馃槉

@waldekmastykarz

Requirements are clear now :/

I am almost done with the implementation. I just wanted to ask you a favor. I am struggling to find the reason why my branch test coverage is still reporting that I am missing some branches. I do not find the line in question.

I made a commit of the solution here: https://github.com/plamber/office365-cli/commits/spo-field-remove-group

Do you mind having a look on it? This is the last activity and we can push these changes for final review.

Thank you

c8, our code coverage solution, doesn't properly support async methods which is why the reported coverage isn't accurate. To keep things simple and consistent, I'd suggest you used promises instead of async. Sorry for the trouble

@waldekmastykarz tried it out with a promise.all and have still the same issue.

Do you have a suggestion how to handle multiple commands and wait for all of them to complete until calling cb? I updated the code as reference

Just to double check that I'm looking at the right question: your code is working and you'd like me to look at the coverage or your code isn't working as expected and you'd like me to have a look at that? 馃槉

Yes, the code coverage is still not ok. I can't find the issue

Cool, I'll take a look

There are two methods decorated with async:

https://github.com/plamber/office365-cli/blob/1555189c1220a85f67799f6362173b376b0ce0ce/src/o365/spo/commands/field/field-remove.ts#L57

and

https://github.com/plamber/office365-cli/blob/1555189c1220a85f67799f6362173b376b0ce0ce/src/o365/spo/commands/field/field-remove.ts#L112

This causes TypeScript to generate a helper that isn't fully covered.

Right now, we can't use async and need to use promises to maintain coverage and be consistent with the rest of the codebase.

@waldekmastykarz ahh... now I got it.

Would it be possible to subscribe to waldekAsADebuggingService? :)

Just pushed the changes for review

Happy to help! 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VelinGeorgiev picture VelinGeorgiev  路  3Comments

OodapowUiPath picture OodapowUiPath  路  3Comments

aakashbhardwaj619 picture aakashbhardwaj619  路  3Comments

StfBauer picture StfBauer  路  3Comments

rabwill picture rabwill  路  3Comments