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

FilePicker Site document libraries - tab allows to select a file from Other Sites Libraries #907

Closed
Ofer-Gal opened this issue May 19, 2021 · 10 comments · Fixed by #1126
Closed
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:enhancement New feature or enhancement of existing capability
Milestone

Comments

@Ofer-Gal
Copy link

FilePicker control
The documentation says:Site document libraries - tab allows to select a file from the existing site document libraries

Category

[X] Enhancement

[ ] Bug

[F] Question

Version

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

Expected / Desired Behavior / Question

Ability to select libraries in any Site with permissions.

Is there a property I can set to get files from any site?

Can I change the context to be of other site to be able to get files from other sites?

Thanks! FilePicker is amazing

@ghost
Copy link

ghost commented May 19, 2021

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label May 19, 2021
@joelfmrodrigues
Copy link
Collaborator

Hi @Ofer-Gal , I don't think you can change the context for that and there is currently no property to allow the URL of a site to be specified.
I had a quick look a the FileBrowserService and seems that adding support for this would not be a complex task. Would you be interested in giving it a go and submitting a PR with the improvement?

@joelfmrodrigues joelfmrodrigues added type:enhancement New feature or enhancement of existing capability and removed Needs: Triage 🔍 labels May 20, 2021
@Ofer-Gal
Copy link
Author

I never learned how to submit a PR. I will give it a try :-)

@joelfmrodrigues
Copy link
Collaborator

@Ofer-Gal sorry for taking so long to reply. Submitting PRs is actually simpler than it may look like at first.
At a very high level (it can also be done in different ways):
-Fork the repository
-If already forked previously, ensure the dev branch in your fork is in sync and contains all the latest changes
-Create a new branch (from dev) for implementing the changes
-Once changes are complete, ensure everything is committed
-Go to GitHub and open the relevant repository
-A notification should appear asking you if you want to create a PR

  • Complete the form following the instructions provided and it's done

There is a detailed guide here:
https://tahoeninjas.blog/2019/08/18/my-github-cheat-sheet-for-pnp-contributions-an-interactive-cheat-sheet/

You can also join for one of the awesome PnP sessions for first-time contributors!
https://pnp.github.io/sharing-is-caring/#pnpsicsessions

@Ofer-Gal
Copy link
Author

I did try :-)
I see I need to make an equivalent of public getListItems in line 27 of /service/FileBrowserService.ts
But I do not know were the replacement URL for this.context.pageContext.web.absoluteUrl will com from.
There should be a textbox for that somewhere. Maybe at the top of the render() in /controls/FileBrowser.tsx

I have no experience with classes. I started react with hooks.
I rather leave this with better developers than I am.
Thank you for the suggestion though.

kadu-jr pushed a commit to kadu-jr/sp-dev-fx-controls-react that referenced this issue Dec 17, 2021
@kadu-jr
Copy link
Contributor

kadu-jr commented Dec 17, 2021

Hey guys,

So, I stumbled on this issue a couple days ago because I needed this feature for my project. As @joelfmrodrigues said, it was not a complex task, but I had to add a new method to fetch the site Title to display it in the breadcumb.
I have submitted a PR #1081 to add this feature. If you find any problem with the implementation, feel free to contact me.

kadu-jr pushed a commit to kadu-jr/sp-dev-fx-controls-react that referenced this issue Dec 21, 2021
AJIXuMuK added a commit that referenced this issue Jan 8, 2022
Issue #907 - Allow Site tab from FIlePicker to pick documents from a different site
@AJIXuMuK AJIXuMuK added this to the 3.6.0 milestone Jan 8, 2022
@AJIXuMuK
Copy link
Collaborator

AJIXuMuK commented Jan 8, 2022

Thanks to @kadu-jr this has been implemented and will be included in the next release.

@AJIXuMuK AJIXuMuK added the status:fixed-next-drop Issue will be fixed in upcoming release. label Jan 8, 2022
@Ofer-Gal
Copy link
Author

I upgraded to "@pnp/spfx-controls-react": "^3.6.0-beta.1671868" but I don't see a way to tell the tab (site tab?) to show libraries from other sites then the current.
Also, Is there a way to change the order of the tabs. (Upload files first, OneDrive second etc..)

Thank you

@AJIXuMuK AJIXuMuK mentioned this issue Feb 12, 2022
@Ofer-Gal
Copy link
Author

@AJIXuMuK can you please tell me how to tell the tab (site tab?) to show libraries from other sites then the current.?

@Ofer-Gal
Copy link
Author

Ofer-Gal commented Feb 13, 2022

When I use webAbsoluteUrl={`${window.location.origin}/teams/${dpcRequest.projectNumber}`} it works fine but I want to show the "General" folder under Shared%20Documents (we renamed it "Working Papers")
So I added defaultFolderAbsolutePath={`${window.location.origin}/teams/${dpcRequest.projectNumber}/Shared%20Documents/General`}
But it errors with : status='404'' dist/node_modules/@pnp/spfx-controls-react/lib/services/FileBrowserService.js:148 [FileBrowser._getListItems]: Something went wrong when executing request. Status='[HTTP]:404 - [CorrelationId]:885b20a0-a02b-1000-97bf-669cb5b3b6d9 [Version]:16.0.0.22126' and shows "This folder is empty" (it always have 6 folders)

What is the right way to set the default folder?
Also, I use webAbsoluteUrl with a state variable but the Picker has the URL cashed or something. If I change the state it does not change the site in the site tab. Is there a way I can force the URL change?
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:enhancement New feature or enhancement of existing capability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants