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

list item attachment #641

Closed
HiteshRepo opened this issue Jan 5, 2024 · 4 comments
Closed

list item attachment #641

HiteshRepo opened this issue Jan 5, 2024 · 4 comments
Assignees
Labels
Needs Attention 👋 question Further information is requested

Comments

@HiteshRepo
Copy link

HiteshRepo commented Jan 5, 2024

Sharepoint site lists has provision to add attachement(s) in the UI.

But GRAPH APIs (and thereby SDK) does not seem to provide a way to fetch/create the list items attachments details.
APIs tried:

type ListItemable interface {
    BaseItemable
    i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
    GetAnalytics()(ItemAnalyticsable)
    GetContentType()(ContentTypeInfoable)
    GetDocumentSetVersions()([]DocumentSetVersionable)
    GetDriveItem()(DriveItemable)
    GetFields()(FieldValueSetable)
    GetSharepointIds()(SharepointIdsable)
    GetVersions()([]ListItemVersionable)
    SetAnalytics(value ItemAnalyticsable)()
    SetContentType(value ContentTypeInfoable)()
    SetDocumentSetVersions(value []DocumentSetVersionable)()
    SetDriveItem(value DriveItemable)()
    SetFields(value FieldValueSetable)()
    SetSharepointIds(value SharepointIdsable)()
    SetVersions(value []ListItemVersionable)()
}

type FieldValueSetable interface {
    Entityable
    i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
}

Although when we fetch fields of list items, it gives an indication if the list item about presence attachements

{
    ...
    "Attachments": true,
    ...
}

There seems to exist a way to fetch them using REST APIs https://{{tenant-id}}.sharepoint.com/_api/web/lists/getbytitle('{{site-name}}')/items({{item-id}})?$expand=AttachmentFiles.

However, it would be better to have that support using GRAPH APIs (and SDK) directly.
Similar to the way there exists support for email messages.

type Messageable interface {
    ...
    GetAttachments()([]Attachmentable)
    SetAttachments(value []Attachmentable)()
    SetHasAttachments(value *bool)()
    ...
}

Moreover, even if we could fetch the attachment details via REST APIs, how can we create/update them?

@rkodev
Copy link
Contributor

rkodev commented Feb 12, 2024

Hi @HiteshRepo

This is a similar case to this as you correctly pointed out about the Graph API. Please create an issue in Microsoft Q&A site.

@rkodev rkodev closed this as completed Feb 12, 2024
@noumanmehboob
Copy link

hi
I am facing the exact similar situation, were you able to find the solution to directly get the list item's attachments ?

@HiteshRepo
Copy link
Author

HiteshRepo commented Aug 6, 2024

@noumanmehboob
Not really with GRAPH APis, we can fetch via Sharepoint REST APIs. I do have a POC for it but we have not integrated it into our products as it requires certificates and additional user permissions.

Here is the SDK that can help with Sharepoint REST APIs

@noumanmehboob
Copy link

thank you @HiteshRepo , I will check the SDK SharePoint REST APIs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention 👋 question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants