User Profile
Dushan996
Copper Contributor
Joined Jun 28, 2023
User Widgets
Recent Discussions
Uploading a file to a SharePoint Document Library Sub Folder using a C# Console Application in 2023
I've been scraping the Internet for two weeks using various different solutions given but none of them work in 2023. Most of the solutions provided are old and they do not work with the new libraries and also because of the added security features such as MFA. Also almost all the given solutions threw some kind of error and various people have suggested various different workarounds in comments to get those fixed. So I've been scanning these threads as well trying various different options but after failing, finally thought of posting it here so this would be useful to someone who is facing similar issues. Why Console app: Because I want to use the Task Scheduler to automate this and run it once per day. Have used other means such as syncing with One Drive but it creates duplicate files every now and then. So thought of using a robust mechanism such as a C# console app but have tried PowerShell scripts as well hoping I will be able to ask the Task Scheduler to run PowerShell scripts on a schedule, but none of them worked. Just to narrow it down - I have disabled MFA - Even tried using an App password (Yes I managed to generate the app passwords successfully, but won't work with C#, always some kind of error, after fixing one you get another but after some point you come to a point where there are no resources on how to fix those errors) - I'm using SharePoint Developer site to test it out at the moment. Example site URL could be: https://5mhhvs.sharepoint.com Created a site called Documents: https://5mhhvs.sharepoint.com/sites/Documents So my goal is to upload a file regularly to a sub folder in the Document Library of the Documents site. Wondering if someone can provide a sample code, together with the package names I need to configure using NuGet and the necessary using statements (as there can be conflicting namespaces) either using username/password approach or app password (ClientID/Secret). Other queries: If there is already a file, will it merge the changes or is there a setting we can configure so that it will merge the changes. If a user has opened the file on SharePoint (and may be has started editing), will we still be able to upload the file or can we force it? Hope someone will be able to put an end to end solution here instead of posting links to previous posts. Thank you in advance.5KViews0likes4CommentsRe: Sharepoint - Office 365 Education
Hi LeonPavesic, I'm in the process of configuring my site. However, I'm unable to add a permission level to a group to allow editing documents without adding/uploading (also should prevent deleting). From the available permission levels Full Control, Design, Edit, Contribute, Read, Restricted View, the first for allows them to add/upload files. So I'm unable to select a permission level which only allows editing a file without uploading/deleting files. I even tried to create a custom permission level by granting only edit access, but this allows uploading as well. So it looks like on SharePoint, if you can edit, you can upload as well. A workaround could be to restrict access at folder level (read only) and grant edit access at file level. But this complicates the scenario adding more configuration work whenever we add new files to the library. If there is a way to define a permission level which allows users in that particular group to edit files in a folder without uploading/deleting, that would be great! Any thoughts? Thank you in advance!1.4KViews0likes1CommentRe: Sharepoint - Office 365 Education
Hi LeonPavesic, Thank you so very much for taking your time to provide a detailed answer promptly and for clarifying all the scenarios I had mentioned. This is very helpful and now I have a clear direction to proceed with. I will get back in case I ran into any issues while doing this. Thank you ever so much Leon!1.5KViews0likes0CommentsSharepoint - Office 365 Education
We need to store a few sets of shared files in a central location. We thought of using the Site concept in SharePoint so that we could use the document library creating different folders/files for different groups. We thought of creating groups such as Group A, Group B, Group C using the Office 365 admin panel. And then create a Site in Sharepoint giving read/edit access to individual groups for different files and folders in the document library. For instance, Group A should be able to access and edit files in Folder X while preventing Group B to edit and Group C to access. Also files in some folders are read only for all the members except for admins. Also members should be able to download non-editable documents and edit them using stand-alone apps. Please, if someone could answer these few queries, that would be great. 1.Is it possible to do this with this approach - using groups created in Office 365 admin panel to configure different access levels for a single document library containing in a single Site? Or if it is not possible to have multiple groups on one site, should we create a Site per group? 2. After adding all three groups as members, can we still grant/deny read/edit access to certain folders in the document library for individual groups? 3. I've heard something called SharePoint Hub. What is this and how it differs from SharePoint , will the Hub platform be better for our usecase? 4. Is there a better way to achieve this using the Office 365 for Education platform? Thank you in advance!Solved1.8KViews0likes5Comments
Recent Blog Articles
No content to show