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

Enhancement: spo site set enhance logo options #5495

Closed
Jwaegebaert opened this issue Sep 15, 2023 · 7 comments
Closed

Enhancement: spo site set enhance logo options #5495

Jwaegebaert opened this issue Sep 15, 2023 · 7 comments
Assignees
Labels
Milestone

Comments

@Jwaegebaert
Copy link
Contributor

Jwaegebaert commented Sep 15, 2023

Right now, when you use siteLogoUrl in the spo site set command, it changes the thumbnail, not the actual logo of the site. Looking at the command's inner workings, it seems the body sent to _api/siteiconmanager/setsitelogo is missing a few things. With some tweaks to this endpoint, we should be able to modify the thumbnail and the logo as well. Let's add another option and adjust the command a bit.

Option Description
--siteThumbnailUrl [siteThumbnailUrl] Set the thumbnail for the site collection. This can be an absolute or relative URL to a file on the current site collection.

The request options for _api/siteiconmanager/setsitelogo should look like this:

  • To update the thumbnail:
const requestOptions: CliRequestOptions = {
  url: `${args.options.url}/_api/siteiconmanager/setsitelogo`,
  headers: {
    accept: 'application/json;odata=nometadata'
  },
  data: {
    aspect: 0,
    relativeLogoUrl: thumbnailUrl,
    type: 0
  },
  responseType: 'json'
};
  • To update the logo:
const requestOptions: CliRequestOptions = {
  url: `${args.options.url}/_api/siteiconmanager/setsitelogo`,
  headers: {
    accept: 'application/json;odata=nometadata'
  },
  data: {
    aspect: 1,
    relativeLogoUrl: logoUrl,
    type: 0
  },
  responseType: 'json'
};
@Jwaegebaert Jwaegebaert added enhancement needs peer review Needs second pair of eyes to review the spec or PR labels Sep 15, 2023
@Adam-it
Copy link
Contributor

Adam-it commented Sep 16, 2023

So just to confirm it the only difference is the aspect 🙂? But is it actually that we have it defined twice in the data 🤔?
Let's not show an example using any but instead let's use CliRequestOptions .

@Jwaegebaert
Copy link
Contributor Author

I don't know why but aspect is the golden property to differentiate a logo from thumbnail and regular logo

@Adam-it
Copy link
Contributor

Adam-it commented Sep 23, 2023

I don't know why but aspect is the golden property to differentiate a logo from thumbnail and regular logo

ok but now we have it twice:

data: {
    aspect: 1,
    relativeLogoUrl: logoUrl,
    aspect: 0
  },

won't this work?

data: {
    aspect: 1,
    relativeLogoUrl: logoUrl,
  },

other than that seems ok and lets open it up for hacktoberfest 👍

@Jwaegebaert
Copy link
Contributor Author

My bad, the last param shouldn't be aspect but is type. I updated the specs.

@Adam-it
Copy link
Contributor

Adam-it commented Sep 24, 2023

My bad, the last param shouldn't be aspect but is type. I updated the specs.

No problem. Seems legit now 👍.
Let's open this up. Thank you @Jwaegebaert for the awesome suggestion 👍

@Adam-it Adam-it added help wanted good first issue hacktoberfest Issue perfect for hacktoberfest and removed needs peer review Needs second pair of eyes to review the spec or PR labels Sep 24, 2023
@reshmee011
Copy link
Contributor

please assign to me to attempt implementing it.

@milanholemans
Copy link
Contributor

All yours @reshmee011 💪

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