// GET https://graph.microsoft.com/v1.0/me?$select=displayName,jobTitle
final User user = graphClient.me().get( requestConfiguration -> {
requestConfiguration.queryParameters.select = new String[] {"displayName", "jobTitle"};
});
// GET https://graph.microsoft.com/v1.0/me?$select=displayName,jobTitle
// Microsoft\Graph\Generated\Users\Item\UserItemRequestBuilderGetQueryParameters
$query = new UserItemRequestBuilderGetQueryParameters(
select: ['displayName', 'jobTitle']);
// Microsoft\Graph\Generated\Users\Item\UserItemRequestBuilderGetRequestConfiguration
$config = new UserItemRequestBuilderGetRequestConfiguration(
queryParameters: $query);
/** @var Models\User $user */
$user = $graphClient->me()
->get($config)
->wait();
# GET https://graph.microsoft.com/v1.0/users/{user-id}?$select=displayName,jobTitle
$userId = "71766077-aacc-470a-be5e-ba47db3b2e88"
# The -Property parameter causes a $select parameter to be included in the request
$user = Get-MgUser -UserId $userId -Property DisplayName,JobTitle
# GET https://graph.microsoft.com/v1.0/me?$select=displayName,jobTitle
# msgraph.generated.users.item.user_item_request_builder
query_params = UserItemRequestBuilder.UserItemRequestBuilderGetQueryParameters(
select=['displayName', 'jobTitle']
)
config = RequestConfiguration(
query_parameters=query_params
)
user = await graph_client.me.get(config)
// GET https://graph.microsoft.com/v1.0/me?$select=displayName,jobTitle
const user = await graphClient
.api('/me')
.select(['displayName', 'jobTitle'])
.get();
// GET https://graph.microsoft.com/v1.0/me/messages/{message-id}
// messageId is a string containing the id property of the message
var message = await graphClient.Me.Messages[messageId]
.GetAsync();
// GET https://graph.microsoft.com/v1.0/me/messages/{message-id}
// messageId is a string containing the id property of the message
result, _ := graphClient.Me().Messages().
ByMessageId(messageId).Get(context.Background(), nil)
// GET https://graph.microsoft.com/v1.0/me/messages/{message-id}
// messageId is a string containing the id property of the message
final Message message = graphClient.me().messages().byMessageId(messageId).get();
// GET https://graph.microsoft.com/v1.0/me/messages/{message-id}
// messageId is a string containing the id property of the message
/** @var Models\Message $message */
$message = $graphClient->me()
->messages()
->byMessageId($messageId)
->get()
->wait();
# GET https://graph.microsoft.com/v1.0/me/messages/{message-id}
# message_id is a string containing the id property of the message
message = await graph_client.me.messages.by_message_id(message_id).get()
// GET https://graph.microsoft.com/v1.0/me/messages/{message-id}
// messageId is a string containing the id property of the message
const message = await graphClient.api(`/me/messages/${messageId}`).get();
// GET https://graph.microsoft.com/v1.0/me/messages/{message-id}?$expand=attachments
// messageId is a string containing the id property of the message
var message = await graphClient.Me.Messages[messageId]
.GetAsync(requestConfig =>
requestConfig.QueryParameters.Expand =
["attachments"]);
// GET https://graph.microsoft.com/v1.0/me/messages/{message-id}?$expand=attachments
// import github.com/microsoftgraph/msgraph-sdk-go/users
expand := users.ItemMessagesMessageItemRequestBuilderGetQueryParameters{
Expand: []string{"attachments"},
}
options := users.ItemMessagesMessageItemRequestBuilderGetRequestConfiguration{
QueryParameters: &expand,
}
// messageId is a string containing the id property of the message
result, _ := graphClient.Me().Messages().
ByMessageId(messageId).Get(context.Background(), &options)
// GET
// https://graph.microsoft.com/v1.0/me/messages/{message-id}?$expand=attachments
// messageId is a string containing the id property of the message
final Message message = graphClient.me().messages().byMessageId(messageId).get( requestConfiguration -> {
requestConfiguration.queryParameters.expand = new String[] {"attachments"};
});
// GET https://graph.microsoft.com/v1.0/me/messages/{message-id}?$expand=attachments
// messageId is a string containing the id property of the message
// Microsoft\Graph\Generated\Users\Item\Messages\Item\MessageItemRequestBuilderGetQueryParameters
$query = new MessageItemRequestBuilderGetQueryParameters(
expand: ['attachments']
);
// Microsoft\Graph\Generated\Users\Item\Messages\Item\MessageItemRequestBuilderGetRequestConfiguration
$config = new MessageItemRequestBuilderGetRequestConfiguration(
queryParameters: $query);
/** @var Models\Message $message */
$message = $graphClient->me()
->messages()
->byMessageId($messageId)
->get($config)
->wait();
# GET https://graph.microsoft.com/v1.0/users/{user-id}/messages?$expand=attachments
$userId = "71766077-aacc-470a-be5e-ba47db3b2e88"
$messageId = "AQMkAGUy.."
# -ExpandProperty is equivalent to $expand
$message = Get-MgUserMessage -UserId $userId -MessageId $messageId -ExpandProperty Attachments
# GET https://graph.microsoft.com/v1.0/me/messages/{message-id}?$expand=attachments
# message_id is a string containing the id property of the message
# msgraph.generated.users.item.messages.item.message_item_request_builder
query_params = MessageItemRequestBuilder.MessageItemRequestBuilderGetQueryParameters(
expand=['attachments']
)
config = RequestConfiguration(
query_parameters=query_params
)
message = await graph_client.me.messages.by_message_id(message_id).get(config)
// GET https://graph.microsoft.com/v1.0/me/messages/{message-id}?$expand=attachments
// messageId is a string containing the id property of the message
const message = await graphClient
.api(`/me/messages/${messageId}`)
.expand('attachments')
.get();
// DELETE https://graph.microsoft.com/v1.0/me/messages/{message-id}
// messageId is a string containing the id property of the message
await graphClient.Me.Messages[messageId]
.DeleteAsync();
// DELETE https://graph.microsoft.com/v1.0/me/messages/{message-id}
// messageId is a string containing the id property of the message
err := graphClient.Me().Messages().
ByMessageId(messageId).Delete(context.Background(), nil)
// DELETE https://graph.microsoft.com/v1.0/me/messages/{message-id}
// messageId is a string containing the id property of the message
graphClient.me().messages().byMessageId(messageId).delete();
// DELETE https://graph.microsoft.com/v1.0/me/messages/{message-id}
// messageId is a string containing the id property of the message
$graphClient->me()
->messages()
->byMessageId($messageId)
->delete()
->wait();
# DELETE https://graph.microsoft.com/v1.0/me/messages/{message-id}
# message_id is a string containing the id property of the message
await graph_client.me.messages.by_message_id(message_id).delete()
// DELETE https://graph.microsoft.com/v1.0/me/messages/{message-id}
// messageId is a string containing the id property of the message
await graphClient.api(`/me/messages/${messageId}`).delete();
使用 POST 创建新实体
对于流畅的样式和基于模板的 SDK,可以使用 方法将新项添加到集合 POST 中。 对于 PowerShell, New-* 命令接受映射到要添加的实体的参数。 从调用返回创建的实体。
// POST https://graph.microsoft.com/v1.0/me/calendars
var calendar = new Calendar
{
Name = "Volunteer",
};
var newCalendar = await graphClient.Me.Calendars
.PostAsync(calendar);
// POST https://graph.microsoft.com/v1.0/me/calendars
calendar := models.NewCalendar()
name := "Volunteer"
calendar.SetName(&name)
result, _ := graphClient.Me().Calendars().Post(context.Background(), calendar, nil)
// POST https://graph.microsoft.com/v1.0/me/calendars
final Calendar calendar = new Calendar();
calendar.setName("Volunteer");
final Calendar newCalendar = graphClient.me().calendars().post(calendar);
// POST https://graph.microsoft.com/v1.0/me/calendars
$calendar = new Models\Calendar();
$calendar->setName('Volunteer');
/** @var Models\Calendar $newCalendar */
$newCalendar = $graphClient->me()
->calendars()
->post($calendar)
->wait();
// PATCH https://graph.microsoft.com/v1.0/teams/{team-id}
var team = new Team
{
FunSettings = new TeamFunSettings
{
AllowGiphy = true,
GiphyContentRating = GiphyRatingType.Strict,
},
};
// teamId is a string containing the id property of the team
await graphClient.Teams[teamId]
.PatchAsync(team);
// PATCH https://graph.microsoft.com/v1.0/teams/{team-id}
final Team team = new Team();
final TeamFunSettings funSettings = new TeamFunSettings();
funSettings.setAllowGiphy(true);
funSettings.setGiphyContentRating(GiphyRatingType.Strict);
team.setFunSettings(funSettings);
// teamId is a string containing the id property of the team
graphClient.teams().byTeamId(teamId).patch(team);
// PATCH https://graph.microsoft.com/v1.0/teams/{team-id}
$funSettings = new Models\TeamFunSettings();
$funSettings->setAllowGiphy(true);
$funSettings->setGiphyContentRating(
new Models\GiphyRatingType(Models\GiphyRatingType::STRICT));
$team = new Models\Team();
$team->setFunSettings($funSettings);
// $teamId is a string containing the id property of the team
$graphClient->teams()
->byTeamId($teamId)
->patch($team);
# PATCH https://graph.microsoft.com/v1.0/teams/{team-id}
# msgraph.generated.models.team_fun_settings.TeamFunSettings
fun_settings = TeamFunSettings()
fun_settings.allow_giphy = True
# msgraph.generated.models.giphy_rating_type
fun_settings.giphy_content_rating = GiphyRatingType.Strict
# msgraph.generated.models.team.Team
team = Team()
team.fun_settings = fun_settings
# team_id is a string containing the id property of the team
await graph_client.teams.by_team_id(team_id).patch(team)
// PATCH https://graph.microsoft.com/v1.0/teams/{team-id}
const team: Team = {
funSettings: {
allowGiphy: true,
giphyContentRating: 'strict',
},
};
// teamId is a string containing the id property of the team
await graphClient.api(`/teams/${teamId}`).update(team);