PUT https://graph.microsoft.com/beta/teams/fd15cad8-80f6-484f-9666-3caf695fbf32/schedule/timeCards/TCK_3cd7413f-0337-433b-9a49-da0923185b3f
Content-type: application/json
{
"userId": "70e47528-2fae-42b5-9d8e-ee73ccd90603",
"state": "clockedOut",
"confirmedBy": "None",
"notes": null,
"clockInEvent": {
"dateTime": "2021-05-21T21:58:41.327Z",
"atApprovedLocation": null,
"notes": {
"contentType": "text",
"content": "update sample notes"
}
},
"clockOutEvent": {
"dateTime": "2021-05-21T22:01:46.205Z",
"atApprovedLocation": null,
"notes": {
"contentType": "text",
"content": "update sample notes"
}
},
"breaks": [
{
"breakId": "BRK_138f4751-68b1-44c1-aca2-2b26cba9e73f",
"notes": null,
"start": {
"dateTime": "2021-05-21T21:59:59.328Z",
"atApprovedLocation": null,
"notes": {
"contentType": "text",
"content": "update sample notes"
}
},
"end": {
"dateTime": "2021-05-21T22:01:10.205Z",
"atApprovedLocation": null,
"notes": {
"contentType": "text",
"content": "update sample notes"
}
}
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var timeCard = new TimeCard
{
UserId = "70e47528-2fae-42b5-9d8e-ee73ccd90603",
State = TimeCardState.ClockedOut,
ConfirmedBy = ConfirmedBy.None,
Notes = null,
ClockInEvent = new TimeCardEvent
{
DateTime = DateTimeOffset.Parse("2021-05-21T21:58:41.327Z"),
AtApprovedLocation = null,
Notes = new ItemBody
{
ContentType = BodyType.Text,
Content = "update sample notes"
}
},
ClockOutEvent = new TimeCardEvent
{
DateTime = DateTimeOffset.Parse("2021-05-21T22:01:46.205Z"),
AtApprovedLocation = null,
Notes = new ItemBody
{
ContentType = BodyType.Text,
Content = "update sample notes"
}
},
Breaks = new List<TimeCardBreak>()
{
new TimeCardBreak
{
BreakId = "BRK_138f4751-68b1-44c1-aca2-2b26cba9e73f",
Notes = null,
Start = new TimeCardEvent
{
DateTime = DateTimeOffset.Parse("2021-05-21T21:59:59.328Z"),
AtApprovedLocation = null,
Notes = new ItemBody
{
ContentType = BodyType.Text,
Content = "update sample notes"
}
},
End = new TimeCardEvent
{
DateTime = DateTimeOffset.Parse("2021-05-21T22:01:10.205Z"),
AtApprovedLocation = null,
Notes = new ItemBody
{
ContentType = BodyType.Text,
Content = "update sample notes"
}
}
}
}
};
await graphClient.Teams["{team-id}"].Schedule.TimeCards["{timeCard-id}"]
.Request()
.PutAsync(timeCard);
const options = {
authProvider,
};
const client = Client.init(options);
const timeCard = {
userId: '70e47528-2fae-42b5-9d8e-ee73ccd90603',
state: 'clockedOut',
confirmedBy: 'None',
notes: null,
clockInEvent: {
dateTime: '2021-05-21T21:58:41.327Z',
atApprovedLocation: null,
notes: {
contentType: 'text',
content: 'update sample notes'
}
},
clockOutEvent: {
dateTime: '2021-05-21T22:01:46.205Z',
atApprovedLocation: null,
notes: {
contentType: 'text',
content: 'update sample notes'
}
},
breaks: [
{
breakId: 'BRK_138f4751-68b1-44c1-aca2-2b26cba9e73f',
notes: null,
start: {
dateTime: '2021-05-21T21:59:59.328Z',
atApprovedLocation: null,
notes: {
contentType: 'text',
content: 'update sample notes'
}
},
end: {
dateTime: '2021-05-21T22:01:10.205Z',
atApprovedLocation: null,
notes: {
contentType: 'text',
content: 'update sample notes'
}
}
}
]
};
await client.api('/teams/fd15cad8-80f6-484f-9666-3caf695fbf32/schedule/timeCards/TCK_3cd7413f-0337-433b-9a49-da0923185b3f')
.version('beta')
.put(timeCard);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams/fd15cad8-80f6-484f-9666-3caf695fbf32/schedule/timeCards/TCK_3cd7413f-0337-433b-9a49-da0923185b3f"]]];
[urlRequest setHTTPMethod:@"PUT"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphTimeCard *timeCard = [[MSGraphTimeCard alloc] init];
[timeCard setUserId:@"70e47528-2fae-42b5-9d8e-ee73ccd90603"];
[timeCard setState: [MSGraphTimeCardState clockedOut]];
[timeCard setConfirmedBy: [MSGraphConfirmedBy none]];
[timeCard setNotes: null];
MSGraphTimeCardEvent *clockInEvent = [[MSGraphTimeCardEvent alloc] init];
[clockInEvent setDateTime: "2021-05-21T21:58:41.327Z"];
[clockInEvent setAtApprovedLocation: null];
MSGraphItemBody *notes = [[MSGraphItemBody alloc] init];
[notes setContentType: [MSGraphBodyType text]];
[notes setContent:@"update sample notes"];
[clockInEvent setNotes:notes];
[timeCard setClockInEvent:clockInEvent];
MSGraphTimeCardEvent *clockOutEvent = [[MSGraphTimeCardEvent alloc] init];
[clockOutEvent setDateTime: "2021-05-21T22:01:46.205Z"];
[clockOutEvent setAtApprovedLocation: null];
MSGraphItemBody *notes = [[MSGraphItemBody alloc] init];
[notes setContentType: [MSGraphBodyType text]];
[notes setContent:@"update sample notes"];
[clockOutEvent setNotes:notes];
[timeCard setClockOutEvent:clockOutEvent];
NSMutableArray *breaksList = [[NSMutableArray alloc] init];
MSGraphTimeCardBreak *breaks = [[MSGraphTimeCardBreak alloc] init];
[breaks setBreakId:@"BRK_138f4751-68b1-44c1-aca2-2b26cba9e73f"];
[breaks setNotes: null];
MSGraphTimeCardEvent *start = [[MSGraphTimeCardEvent alloc] init];
[start setDateTime: "2021-05-21T21:59:59.328Z"];
[start setAtApprovedLocation: null];
MSGraphItemBody *notes = [[MSGraphItemBody alloc] init];
[notes setContentType: [MSGraphBodyType text]];
[notes setContent:@"update sample notes"];
[start setNotes:notes];
[breaks setStart:start];
MSGraphTimeCardEvent *end = [[MSGraphTimeCardEvent alloc] init];
[end setDateTime: "2021-05-21T22:01:10.205Z"];
[end setAtApprovedLocation: null];
MSGraphItemBody *notes = [[MSGraphItemBody alloc] init];
[notes setContentType: [MSGraphBodyType text]];
[notes setContent:@"update sample notes"];
[end setNotes:notes];
[breaks setEnd:end];
[breaksList addObject: breaks];
[timeCard setBreaks:breaksList];
NSError *error;
NSData *timeCardData = [timeCard getSerializedDataWithError:&error];
[urlRequest setHTTPBody:timeCardData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
TimeCard timeCard = new TimeCard();
timeCard.userId = "70e47528-2fae-42b5-9d8e-ee73ccd90603";
timeCard.state = TimeCardState.CLOCKED_OUT;
timeCard.confirmedBy = EnumSet.of(ConfirmedBy.NONE);
timeCard.notes = null;
TimeCardEvent clockInEvent = new TimeCardEvent();
clockInEvent.dateTime = OffsetDateTimeSerializer.deserialize("2021-05-21T21:58:41.327Z");
clockInEvent.atApprovedLocation = false;
ItemBody notes1 = new ItemBody();
notes1.contentType = BodyType.TEXT;
notes1.content = "update sample notes";
clockInEvent.notes = notes1;
timeCard.clockInEvent = clockInEvent;
TimeCardEvent clockOutEvent = new TimeCardEvent();
clockOutEvent.dateTime = OffsetDateTimeSerializer.deserialize("2021-05-21T22:01:46.205Z");
clockOutEvent.atApprovedLocation = false;
ItemBody notes2 = new ItemBody();
notes2.contentType = BodyType.TEXT;
notes2.content = "update sample notes";
clockOutEvent.notes = notes2;
timeCard.clockOutEvent = clockOutEvent;
LinkedList<TimeCardBreak> breaksList = new LinkedList<TimeCardBreak>();
TimeCardBreak breaks = new TimeCardBreak();
breaks.breakId = "BRK_138f4751-68b1-44c1-aca2-2b26cba9e73f";
breaks.notes = null;
TimeCardEvent start = new TimeCardEvent();
start.dateTime = OffsetDateTimeSerializer.deserialize("2021-05-21T21:59:59.328Z");
start.atApprovedLocation = false;
ItemBody notes4 = new ItemBody();
notes4.contentType = BodyType.TEXT;
notes4.content = "update sample notes";
start.notes = notes4;
breaks.start = start;
TimeCardEvent end = new TimeCardEvent();
end.dateTime = OffsetDateTimeSerializer.deserialize("2021-05-21T22:01:10.205Z");
end.atApprovedLocation = false;
ItemBody notes5 = new ItemBody();
notes5.contentType = BodyType.TEXT;
notes5.content = "update sample notes";
end.notes = notes5;
breaks.end = end;
breaksList.add(breaks);
timeCard.breaks = breaksList;
graphClient.teams("fd15cad8-80f6-484f-9666-3caf695fbf32").schedule().timeCards("TCK_3cd7413f-0337-433b-9a49-da0923185b3f")
.buildRequest()
.put(timeCard);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
requestBody.SetAdditionalData(map[string]interface{}{
"userId": "70e47528-2fae-42b5-9d8e-ee73ccd90603",
"state": "clockedOut",
"confirmedBy": "None",
"notes": nil,
"breaks": []Object {
}
}
teamId := "team-id"
timeCardId := "timeCard-id"
graphClient.TeamsById(&teamId).Schedule().TimeCardsById(&timeCardId).Put(requestBody)