Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 1.05 KB

attachment-createuploadsession-go-snippets.md

File metadata and controls

33 lines (25 loc) · 1.05 KB
description
Automatically generated file. DO NOT MODIFY
// Code snippets are only available for the latest major version. Current major version is $v1.*// Dependenciesimport ( "context" msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" graphusers "github.com/microsoftgraph/msgraph-sdk-go/users" graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"//other-imports ) requestBody:=graphusers.NewItemCreateUploadSessionPostRequestBody() attachmentItem:=graphmodels.NewAttachmentItem() attachmentType:=graphmodels.FILE_ATTACHMENTTYPEattachmentItem.SetAttachmentType(&attachmentType) name:="flower"attachmentItem.SetName(&name) size:=int64(3483322) attachmentItem.SetSize(&size) requestBody.SetAttachmentItem(attachmentItem) // To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=gocreateUploadSession, err:=graphClient.Me().Messages().ByMessageId("message-id").Attachments().CreateUploadSession().Post(context.Background(), requestBody, nil) 
close