Skip to content

ListItemAttachments webUrl property is not working #1975

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

Open
Floris-Pleegzorg-Oost-Vlaanderen opened this issue Apr 15, 2025 · 2 comments
Open

Comments

@Floris-Pleegzorg-Oost-Vlaanderen

Category

[ ] Enhancement

[X ] Bug

[ ] Question

Version

Please specify what version of the library you are using: [3.20.0]

If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.

Expected / Desired Behavior / Question

I want to use ListItemAttachments in my project and I test with sharepoint.com/_layouts/15/workbench.aspx.

My component request looks like this.

<ListItemAttachments
                    webUrl="https://tenantname.sharepoint.com/sites/Data/"
                    listId="0299c622-3efe-4b97-81f1-7e082d157bla"
                    itemId={15}
                    context={context}
                />

Observed Behavior

I always get the following message "Problem loading attachment, reason: files is null"
In the webbrowser console I see that instead of the webUrl being used the base url is used. I see this:

https://tenantname.sharepoint.com/_api/web/lists(@listId)/items(@itemId)/AttachmentFiles?@listId=guid'0299c622-3efe-4b97-81f1-7e082d157bla'&@itemId=15

I expected:

https://tenantname.sharepoint.com/sites/Data/_api/web/lists(@listId)/items(@itemId)/AttachmentFiles?@listId=guid'0299c622-3efe-4b97-81f1-7e082d157bla'&@itemId=15

I think that the problem is that in the file
src/controls/listItemAttachments/ListItemAttachments.tsx

this._spservice is called but webUrl is not always passed.

Copy link

Thank you for submitting your first issue to this project.

@krispleegzorgoostvlaanderen

I think the problem is here, the webUrl is not passed when creating the SPservice:
40a61d8#r155471012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants