question

AaronMina-3569 avatar image
0 Votes"
AaronMina-3569 asked MichaelHan-MSFT edited

Using SPFX to list the Project Documents

I am new to developing for SharePoint and trying to find the documentation to make a web part to list the project documents. I found documentation and videos for bringing in the project information:

 .get(`${this.props.context.pageContext.web.absoluteUrl}/_api/web/lists/GetByTitle('Projects')/Items?$expand=ProjectManager&$select=*,ProjectManager,ProjectManager/EMail,ProjectManager/Title`,

And can filter the list of projects with this:

 .get(`${this.props.context.pageContext.web.absoluteUrl}/_api/web/lists/GetByTitle('Projects')/Items?$expand=ProjectManager&$select=*,ProjectManager,ProjectManager/EMail,ProjectManager/Title&$filter=Title eq %27${filterVal}%27`,


Any help is much appreciated.

Thank you

office-sharepoint-onlinesharepoint-devoffice-sharepoint-server-developmentoffice-sharepoint-server-customization
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

sadomovalex avatar image
0 Votes"
sadomovalex answered AaronMina-3569 commented

yes, in SPFx you should use SP REST API for fetching list of documents from doclibs - like shown in your example. But what is actual question?

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @sadomovalex

In the examples shown only displays the projects and I want the files associated to the projects.

Here is a few examples of what I have:
142536-image.png
142537-image.png
142505-image.png
142448-image.png
142494-image.png
142541-image.png

What I am looking to do is bring in these projects documents instead of this information.


0 Votes 0 ·
MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered MichaelHan-MSFT edited

Hi @AaronMina-3569,

They are two lists. And you only get the items in the Projects list. You also need to get the items from Project Documents list.

In the list Project Documents, the Project column looks like a lookup field. So it 'svalue should be the id in Projects list

The process would be like this: First get the items in Project Documents, and in eachitem use the Project cloumn value to get the specfic item in Projects list.



If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @MichaelHan-MSFT

That is what I have been looking to do. I just can't find out how to get the project documents list. I've looked through the documentation on Microsoft and other places and haven't found which API calls to make or if there is additional setup within the props and state files to be able to accept it.

Can you give me an example or direct me to the API documentation to be able to pull this information?

0 Votes 0 ·

To get items from a list/library, usually we use the below api to achieve this: /_api/web/lists/GetByTitle('List Name')/Items.


So you could try to use the api /_api/web/lists/GetByTitle('Project Documents')/Items to get items in project documents, check if it work for you.


0 Votes 0 ·

@MichaelHan-MSFT

I tried before and it didn't work. Is there any other ways to get the project documents?

0 Votes 0 ·
Show more comments