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

Merge in bcameron1231-v4-Admin #2899

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
312 changes: 312 additions & 0 deletions docs/graph/admin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
# @pnp/graph/admin

The ability to work with Microsoft Graph Admin APIs

## Admin, IAdmin, SharePointSettings, ISharePointSettings, ServiceAnnouncements, IServiceAccouncements, PeopleAdmin, IPeopleAdmin

[![Invokable Banner](https://img.shields.io/badge/Invokable-informational.svg)](../concepts/invokable.md) [![Selective Imports Banner](https://img.shields.io/badge/Selective%20Imports-informational.svg)](../concepts/selective-imports.md)


## SharePoint Settings
### Get SharePoint Tenant Settings

Using sharePointSettings() you can retrieve the SharePoint Tenant Settings

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const settings = await graph.admin.sharepoint.settings();

```
### Update SharePoint Tenant Settings

Update SharePoint Tenant Settings

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const settings = await graph.admin.sharepoint.settings.update({deletedUserPersonalSiteRetentionPeriodInDays: 5, isCommentingOnSitePagesEnabled: true});

```

## People

### Get People Settings

Represents a setting to control people-related admin settings in the tenant.

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const peopleSettings = await graph.admin.people();

```
### Get People Pronoun Settings

Represents the settings that manage the support of pronouns in an organization.

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const pronounSettings = await graph.admin.people.pronounSettings();

```
### Update People Pronoun Settings

Update Pronoun Settings in an organization

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const pronounSettings = await graph.admin.people.pronounSettings.update({
isEnabledInOrganization:true
});

```
### Profile Card Properties

Gets a collection profile card properties for an organization

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const profileCardProperties = await graph.admin.people.profileCardProperties();

```
### Add Profile Card Property

Add a profile card property.

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const profileCardProperty = await graph.admin.people.profileCardProperties.add({
directoryPropertyName: "CustomAttribute1",
annotations: [{
displayName: "Cost Center",
localizations: [
{
languageTag: "ru-RU",
displayName: "центр затрат"
}
]
}]
});

```
### Get Profile Card Property

Retrieve the properties of a profile card property.

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const profileCardProperty = await graph.admin.people.profileCardProperties.getById("CustomAttribute1")();

```
### Update Profile Card Property

Updates the properties of a profile card property.

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const profileCardProperty = await graph.admin.people.profileCardProperties.getById("CustomAttribute1").update({
directoryPropertyName: "CustomAttribute1",
annotations: [{
displayName: "Cost Center 2",
localizations: [
{
languageTag: "ru-RU",
displayName: "центр затрат"
}
]
}]
});

```
### Delete Profile Card Property

Delete a property of a profile card

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

await graph.admin.people.profileCardProperties.getById("CustomAttribute1").delete();

```
## Service Announcements

### Get Health overviews

Retrieves the service health report for a tenant

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const healthOverviews = await graph.admin.serviceAnnouncements.healthOverviews();

```
### Get Service Health By Name

Retrieves the service health report for a tenant

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const serviceHealth = await graph.admin.serviceAnnouncements.healthOverviews.getByName("Microsoft 365 suite")();

```
### Get Health Issues

Retrieves the service health issues for a tenant

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const issues = await graph.admin.serviceAnnouncements.issues();

```
### Get Health Messages

Retrieves the service health messages for a tenant

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const messages = await graph.admin.serviceAnnouncements.messages();

```
### Get Specific Service Health Message

Retrieves a specific service health message

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const message = await graph.admin.serviceAnnouncements.messages.getById("MC172851");

```

### Archive/unarchive Service Health Messages

Archive the specified service health messages

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

//archive
await graph.admin.serviceAnnouncements.messages.archive(["MC172851","MC172333"]);

//unarchive
await graph.admin.serviceAnnouncements.messages.unarchive(["MC172851","MC172333"]);

```
### Favorite/unfavorite Service Health Messages

Favorites the specified service health messages

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

//favorite
await graph.admin.serviceAnnouncements.messages.favorite(["MC172851","MC172333"]);

//unfavorite
await graph.admin.serviceAnnouncements.messages.unfavorite(["MC172851","MC172333"]);

```
### Mark as read / Mark unread Service Health Messages

Marks the specified service health messages as read or unread

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

//mark as read
await graph.admin.serviceAnnouncements.messages.markRead(["MC172851","MC172333"]);

//mark as unread
await graph.admin.serviceAnnouncements.messages.markUnread(["MC172851","MC172333"]);

```
### Get Attachments of Service Health Message

Get attachments of Service Health Message

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const attachments = await graph.admin.serviceAnnouncements.messages.getById("MC172851").attachments();

```
### Get Attachment of Service Health Message by id

Get the specified attachment by id

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/admin";

const graph = graphfi(...);

const attachment = await graph.admin.serviceAnnouncements.messages.getById("MC172851").attachments.getById("30356a46-ffad-47e1-acf6-40a99b1538c1")

```
2 changes: 1 addition & 1 deletion docs/graph/analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Using analytics() you get the Item Analytics for a Drive Item
```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/users";
import "@pnp/graph/drive";
import "@pnp/graph/files";
import "@pnp/graph/analytics";
import { IAnalyticsOptions } from "@pnp/graph/analytics";

Expand Down
42 changes: 42 additions & 0 deletions packages/graph/admin/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { defaultPath } from "../decorators.js";
import { GraphFI } from "../fi.js";
import { _GraphQueryable, graphInvokableFactory } from "../graphqueryable.js";
import { IPeopleAdmin, PeopleAdmin } from "./people.js";
import { IServiceAccouncements, ServiceAnnouncements} from "./serviceAnnouncements.js";
import { SharePointAdmin, ISharePointAdmin } from "./sharepoint.js";

declare module "../fi" {
interface GraphFI {
readonly admin: IAdmin;
}
}

defaultPath("admin");
class _Admin extends _GraphQueryable<IAdmin> {
public get people(){
return PeopleAdmin(this);
}
public get sharepoint() {
return SharePointAdmin(this);
}
public get serviceAnnouncements() {
return ServiceAnnouncements(this);
}
}

export interface IAdmin {
readonly people: IPeopleAdmin;
readonly sharepoint: ISharePointAdmin;
readonly serviceAnnouncements: IServiceAccouncements;
}

export const Admin: IAdmin = <any>graphInvokableFactory(_Admin);


Reflect.defineProperty(GraphFI.prototype, "admin", {
configurable: true,
enumerable: true,
get: function (this: GraphFI) {
return this.create(<any>Admin, "admin");
},
});
Loading
Loading