Create views in SharePoint that only show items created by current user

This is an oldie but a goodie in my opinion, this post will show you how to use library filters in SharePoint to only show items/ files created, or modified by the current user.

The steps below will guide you through the process of updating the view of a list or library to only show items created or modified by the current, logged in user.

  • Open the list or library you wish to update
  • From the library actions ribbon > select the current view (for example: all documents)
  • Press edit current view
  • Scroll down the edit view page until you get to the filter section
  • Create the following filter:

NOTE: this example will only show items that were created by OR modified by the current, logged in user. If you want your filter to only show items where both these values are true, change OR to AND.

  • Press OK to save your changes

Now your view should have updated to only show items created by, or modified by the current, logged in user.

Considerations

This example is really simple and easy to implement and there isn’t any real impact on your users as nothing is technically being restricted, just filtered out of the default view.

The flip-side of this is that in of itself could be considered a limitation if there is information stored within the list/ library that requires limited permissions. I’ll go into the options available for this later in this post.

However with that said, depending on what permissions you have in place for your list/ library, you could use this approach to secure the contents too.

Consideration #1 – Views don’t change permissions

A “back door” to gaining access to all contents stored in the list/ library would be to use a different view than the set default view to access all items (for example: if you created a new view to follow the below method, but left the default view set to show everything).

The solution to this would be to apply this filter approach to the default view, make sure any other public views follow the same approach and make sure end users don’t have elevated permissions.

Consideration #2 – Ensure permissions are set correctly

The only way an end user could bypass this approach without any “all items” views available, would be if they had the permissions to do so. The permission that controls this is called the Manage Lists permission, which is only granted via the Edit, Design, Full Control, Manage Hierarchy permission levels by default.

If end users aren’t in these groups, your in luck!

Consideration #3 – list/ library contents is not searchable

If you are using views to filter who can see contents within your list/ library then you will need to ensure this setting is updated if the contents needs to be hidden (below example is a document library):

  • Press the cog button > library settings
  • Press advanced settings
  • Under Search > change allow items from this document library to appear in search results to No
  • Press OK
Update the allow items from this document library to appear in search results advanced setting to ensure items aren’t visible in search.

Consideration #4 – If it’s a list, enable item level permissions

With lists, in advanced settings there is an additional configuration option – item level permissions which allows you to specify which items users can read and edit.

As the heading implies, this consideration only works for lists in SharePoint as the functionality isn’t available out the box for document libraries. SharePoint Maven have written up what the two different levels of item level permissions you can set mean, which you can find here.


Advertisement

The URL is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web – how to fix

In this post we describe an issue observed within a SharePoint 2010 environment where files could not be uploaded or edited and users received a “nonexistent file or folder” message, plus explain how to resolve.

The problem

Reports started coming in from users that when they tried to upload files or edit properties within a single site collection they received the following error message:

The URL is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.

Over the course of a couple of days, the changed and instead of seeing the above error the window would just hang when uploading files/ editing properties and users would see a “processing” message:

Processing message appears and does nothing when users upload files/ edit properties.

In this example, there is one, very large document library that was most affected by this issue within the site collection. So the first thing I did was take a look at the files with no checked in version within the document library settings.

I found that there was close to 1000 files with no checked in version. When trying to open the checked out files page it took an age until finally opening. I was unable to take ownership of all of the files and check them in, but this didn’t make any difference to the issue.

We have set up nightly IIS resets on our web front end servers so overnight this took place in the hopes restarting the web services might help, but this also didn’t fix anything.

The solution

After the IIS reset, I began looking into the SQL server too see if space was the issue. Sure enough I found that one of the drives that hosted the content database related to the site collection in question had less than 10MB free space!

So for us the solution was a simple one, we increased the space on the full drive and the issue went away. Users are once again able to upload files/ edit properties within the site collection.

Other common suggested fixes to try

In writing this post, I researched many of the other suggested fixes for this issue – so here’s a list:


Useful SharePoint URLs

This post is to serve as a reference point for all the useful shortcut URLs in SharePoint that help admins and super users get their jobs done much easier.

There are several blog posts by others with these URLs in them, but I wanted to preserve them in my own blog for future generations! Most of these links have come from SharePoint 2010, so if you want them to work in differing versions just add a 14, 15 or 16 after the layouts folder to work in 2010, 2013, 2016 or SharePoint Online.

Frequently used

TitleURL
Remove nav bar, header & command bar ?env=WebView (after .aspx)
Remove nav bar & header?env=Embedded
Open list/ library in Microsoft Lists?env=WebViewList
Site contents/_layouts/15/viewlsts.aspx
/_layouts/15/viewlsts.aspx?view=14 (old style view)
Manage content & structure/_layouts/sitemanager.aspx
Audit log reports /_layouts/Reporting.aspx?Category=Auditing
Shared with us/Shared%20Documents/Forms/AllItems.aspx?view=3

Users and permissions

TitleURL
People/_layouts/people.aspx
Groups/_layouts/groups.aspx
Site Collection Admins /_layouts/mngsiteadmin.aspx
Advanced Permissions /_layouts/user.aspx

Galleries

TitleURL
Site Columns/_layouts/mngfield.aspx
Site content types/_layouts/mngctype.aspx
Web parts/_catalogs/wp/Forms/AllItems.aspx
List templates/_catalogs/lt/Forms/AllItems.aspx
Master Pages/_layouts/ChangeSiteMasterPage.aspx
Themes/_catalogs/theme/Forms/AllItems.aspx
Solutions/_catalogs/solutions/Forms/AllItems.aspx

Site administration

TitleURL
Regional settings/_layouts/regionalsetng.aspx
Content and structure/_Layouts/sitemanager.aspx?Source={WebUrl}_layouts/settings.aspx
Content and structure logs/_Layouts/SiteManager.aspx?lro=all
Site libraries and lists/_layouts/mcontent.aspx
User alerts/_layouts/sitesubs.aspx
RSS/_layouts/siterss.aspx
Search and offline availability/_layouts/srchvis.aspx
Sites and workspaces/_layouts/mngsubwebs.aspx
Workflows/_layouts/wrkmng.aspx
Workflow settings/_layouts/wrksetng.aspx
Related Links scope settings/_layouts/RelLinksScopeSettings.aspx
Content Organizer Settings/_layouts/DocumentRouterSettings.aspx?Source=settings.aspx
Content Organizer Rules/RoutingRules/Group%20by%20Content%20Type.aspx
Site output cache/_Layouts/areacachesettings.aspx
Term store management/_Layouts/termstoremanager.aspx
Taxonomy Hidden List/Lists/TaxonomyHiddenList
Searchable columns/_Layouts/NoCrawlSettings.aspx

Look and feel

TitleURL
Welcome page/_Layouts/AreaWelcomePage.aspx
Title, description and icon/_layouts/prjsetng.aspx
Master page/_Layouts/ChangeSiteMasterPage.aspx
Page layouts and site templates/_Layouts/ChangeSiteMasterPage.aspx
Tree view/_layouts/navoptions.aspx
Site theme/_layouts/themeweb.aspx
Navigation/_layouts/AreaNavigationSettings.aspx

Site actions

TitleURL
Manage site features/_layouts/ManageFeatures.aspx
Reset to site definition/_layouts/reghost.aspx
Delete this site/_layouts/deleteweb.aspx
Site web analytics reports/_layouts/WebAnalytics/Report.aspx?t=SummaryReport&l=s
Site collection web analytics reports/_layouts/WebAnalytics/Report.aspx?t=SummaryReport&l=sc

Site collection administration

TitleURL
Search settings/_layouts/enhancedSearch.aspx
Search scopes/_layouts/viewscopes.aspx
Search keywords/_layouts/listkeywords.aspx
Site level recycle bin/_layouts/RecycleBin.aspx
Site collection recycle bin/_layouts/AdminRecycleBin.aspx
Site collection features/_layouts/ManageFeatures.aspx?Scope=Site
Site directory settings/_layouts/SiteDirectorySettings.aspx
Site hierarchy/_layouts/vsubwebs.aspx
Site collection navigation/_layouts/SiteNavigationSettings.aspx
Site collection audit settings/_layouts/AuditSettings.aspx
Audit log reports/_layouts/Reporting.aspx?Category=Auditing
Portal site connection/_layouts/portal.aspx
Site collection policies/_layouts/Policylist.aspx
Storage Metrics/_layouts/storman.aspx
Record declaration settings/_layouts/InPlaceRecordsSettings.aspx?Source=settings.aspx
Content type publishing/_Layouts/contenttypesyndicationhubs.aspx
Site collection cache profiles/_Layouts/RedirectPage.aspx?Target={SiteCollectionUrl}cache profiles
Site collection object cache/_Layouts/objectcachesettings.aspx
Content type service application error log/Lists/ContentTypeAppLog
Site collection output cache/_Layouts/sitecachesettings.aspx
Variations/_Layouts/VariationSettings.aspx
Variation labels/_Layouts/VariationLabels.aspx
Translatable columns/_Layouts/TranslatableSettings.aspx
Variation logs/_Layouts/VariationLogs.aspx
Suggested Content Browser Locations/PublishedLinks/
Document ID settings/_Layouts/DocIdSettings.aspx
SharePoint Designer Settings/_layouts/SharePointDesignerSettings.aspx
Visual Upgrade/_layouts/suppux.aspx
Help settings/_layouts/HelpSettings.aspx

Central administration

TitleURL
Manage web applications/_admin/WebApplicationList.aspx
Create site collections/_admin/createsite.aspx
Manage service applications/_admin/ServiceApplications.aspx
Manage content databases/_admin/CNTDBADM.aspx
Check job status/_admin/Timer.aspx
Manage farm administrators group/_layouts/people.aspx?MembershipGroupId=3
Configure service accounts/_admin/FarmCredentialManagement.aspx
Configure send to connections/_admin/OfficialFileAdmin.aspx
Configure content deployment paths and jobs/_admin/Deployment.aspx
Manage form templates_admin/ManageFormTemplates.aspx
Manage servers in farm/_admin/FarmServers.aspx
Manage services on server/_admin/Server.aspx
Manage farm features/_admin/ManageFarmFeatures.aspx
Configure alternate access mappings/_admin/AlternateUrlCollections.aspx
Perform a backup/_admin/Backup.aspx
Restore from backup/_admin/BackupHistory.aspx?restore=1&filter=1
Perform site collection backup/_admin/SiteCollectionBackup.aspx
Convert farm license type/_admin/Conversion.aspx
Check product and patch installation status/_admin/PatchStatus.aspx
Check upgrade status/_admin/UpgradeStatus.aspx

Common actions

TitleURL
Create new_layouts/spscreate.aspx
_layouts/create.aspx
View lists_layouts/viewlsts.aspx
Create site groups _layouts/permsetup.aspx
Quick launch_layouts/quiklnch.aspx
Workflow history list/lists/Workflow History
SharePoint server version + patch level/_vti_pvt/Service.cnf (run at site collection level)
Web part maintenance mode?Contents=1 (classic)
?maintenancemode=true (modern)
Save as site template_layouts/savetmpl.aspx
Manage user alerts_layouts/AlertsAdmin.aspx

REST API examples

OperationSharePoint REST API endpoint
Site
Get a SharePoint Site Collectionhttps://%5Byour site url]/_api/site
Get a specific site or webhttps://%5Byour site url]/_api/web
Get a sites titlehttps://%5Byour site url]/_api/title
List
Get all lists from a sitehttps://%5Byour site url]/_api/web/lists
Get all items from a listhttps://%5Byour site url]/_api/web/lists/getbytitle(‘listname’)/items
Get a lists titlehttps://%5Byour site url]/_api/web/lists/getbytitle(‘listname’)?select=Title
Get all columns within a listhttps://%5Byour site url]/_api/web/lists/getbytitle(‘listname’)/Fields
Get list from GUIDhttps://%5Byour site ur]}/_api/Web/Lists(‘list GUID here’)
Get list item by IDhttps://%5Byour site ur]}/_api/Web/Lists/GetByTitle/(‘listtitle’)/GetItemById(2)
Get selected fields for list itemshttps://%5Byour site ur]}/_api/Web/Lists/GetByTitle/(‘listtitle’)/Items?select=ID,Title
User
Get current user informationhttps://%5Byour site url]/_api/web/currentUser
Get all site usershttps://%5Byour site url]/_api/Web/siteusers
Group
Get all groups from the sitehttps://%5Byour site url]/_api/Web/siteusers/sitegroups
Get group by group IDhttps://%5Byour site url]/_api/Web/sitegroups/GetById(GroupId)
Get all users from grouphttps://%5Byour site url]/_api/Web/sitegroups(Id)/users
Source: SP guides

How to open SharePoint pages in maintenance mode

This post demonstrates how to access the web part maintenance page for a classic and modern SharePoint site to delete any problem web parts.

Classic SharePoint

Recently I came across an issue with a SharePoint 2010 publishing site. The site had a page on it that was being edited and after a series of web parts were added, crashed and would no longer load. An additional issue here was that there wasn’t another, recent version of the page to restore to.

So, in the steps below detail how I was able to access the page using web part maintenance mode and delete the problem web part:

  • Navigate to the problem page’s URL
  • At the end of the URL add ?contents=1
  • This will then open the problem page up in web part maintenance mode. From here you are able to close, restore defaults or delete web parts from your page

NOTE: make sure you page is checked out before trying this else you won’t be able to make any changes.

  • Select the web part(s) which you think are causing the issue
  • Now select to either close, reset or delete the web part. I chose delete
  • A warning message will appear > press OK

Modern SharePoint

When writing this post I wondered if this method of accessing web part maintenance mode still worked for modern SharePoint – the answer was no! When you try to open a modern page using ?contents=1 you get this:

Opening modern SharePoint pages in classic maintenance mode won’t work.

However, after reading this handy article from Microsoft about maintenance for client-side web parts in SharePoint Online I just switched my query to ?maintenancemode=true and it worked!

Modern web parts have there own query to append to the page URL to access maintenance mode.

Different to the classic example, modern web parts when in maintenance mode show summary, manifest and data tabs with information about each web part.

If you wish to delete a web part from this view you will need to edit the page and delete it from there, then republish like in the example below:

Deleting web parts in maintenance mode within a modern SharePoint page.

SharePoint URL’s

There are loads of URL’s that either I can never remember or haven’t come across that are listed here. However I wanted to keep a list of them on my site just for reference:

DestinationURL
Site Settings/_layouts/settings.aspx
Site Contents/_layouts/viewlsts.apx
Save Site as a Template/_layouts/savetmpl.aspx
View All People/_layouts/people.aspx?MembershipGroupId=0
View People and Groups/_layouts/groups.aspx
Workflows/_layouts/wrkmng.aspx
Workflow Health/_layouts/15/workflowservicehealth.aspx
Workflow History (Hidden)/lists/Workflow%20History
Create New Site items/_layouts/create.aspx
Manage Site Collection Admin Permissions/_layouts/mngsiteadmin.aspx
View Sites and Workspaces/_layouts/mngsubwebs.aspx
Manage User Permissions/_layouts/user.aspx
Recycle Bin/_layouts/RecycleBin.aspx
Second-Stage Recycle Bin (w/ Admin Permissions)/_layouts/AdminRecycleBin.aspx
Manage Site Content and Structure/_layouts/sitemanager.aspx
Manage Site Content Types/_layouts/mngctype.aspx
Manage Site Columns/_layouts/mngfield.aspx
Quick Launch Settings/_layouts/quiklnch.aspx
Navigation Settings/_layouts/AreaNavigationSettings.aspx
Web Analytics Reports (Site Usage Summary)/_layouts/usage.aspx
Manage Site Collection Features/_layouts/ManageFeatures.aspx?Scope=Site
Manage Site Features/_layouts/ManageFeatures.aspx
Application page for registering SP Apps/_layouts/appregnew.aspx
Sign in as a different user/_layouts/closeConnection.aspx?loginasanotheruser=true
Enable SharePoint Designer/_layouts/SharePointDesignerSettings.aspx
Welcome Page/_layouts/AreaWelcomePage.aspx
Change Site Master Page/_layouts/ChangeSiteMasterPage.aspx
Page Layouts and Site Templates/_Layouts/AreaTemplateSettings.aspx
Force Display the User Profile in the Site Collection/_layouts/userdisp.aspx?id={UserID}&Force=True
Site App Permissions/_layouts/15/appprincipals.aspx?Scope=Web
List Template Gallery/_catalogs/lt
Master Page Gallery/_catalogs/masterpage
Solution Gallery/_catalogs/solutions/
Web Part Gallery/_catalogs/wp
Get SharePoint Server Version/_vti_pvt/Service.cnf
Taxonomy List (Hidden)Lists/TaxonomyHiddenList/AllItems.aspx
Quick Deploy ItemsQuick%20Deploy%20Items/AllItems.aspx
Web Part Maintenance Page?Contents=1
Filter Toolbar (For Lists and Libraries)?Filter=1
Load Ribbon Tab (In a Document Library or List)?InitialTabId=Ribbon.Document
Show Page in a Dialog?isdlg=1
Display List in Grid View (In Document Library or List)?ShowInGrid=True
Open Page in Edit Mode?ToolPaneView=2

Finding the task properties pane in SharePoint 2013 workflows

(this post was written using a SharePoint online environment and SharePoint Designer 2013)

So here’s the scenario, there is a central list where users add items and once submitted a workflow runs that assigns tasks to separate task lists. No big deal right?

The scenario

Task actions in SharePoint 2013 workflows are a pretty standard thing, the example above just assigns tasks to different lists (think HR, IT, Pensions) for work to be completed. The additional requirement I had was for these tasks to not send any system generated assignment emails when the tasks are assigned.

Example of creating & assigning a task in a SharePoint 2013 workflow.

The problem

This one really had me pulling my hair, but in a nutshell there is no obvious way to turn on/ off the emails that are system generated at the point which a task is assigned.

When you double-click on a task, an “Assign a Task” window opens. Within this window there is an “Email options” drop down, but this only has the email editor for the task creation email and the ability to turn on/ off the task overdue email(s). It doesn’t have any settings for switching on/ off the initial emails themselves.

The Assign a Task window doesn’t contain the properties to switch off system generated emails.

The hidden task properties pane

So at this point I began thinking there is no way to do this and the design for this process is now fundamentally flawed…until I right-clicked!

If you right-click on the list within the assign task action (the ICT Task List Members bit underlined in the example below) a menu will appear. Normally this menu contains some simple options like moving an action up or down. However, with task actions there is an additional option called “properties”.

Hidden properties button within the “assign a task” action.

After clicking on the “Properties” button, you’ll find an additional “Assign a Task Properties” window which contains the following, hidden properties:

Hidden assign a task properties window.
  • PreserveIncompleteTasks: set to true if you want non-completed tasks to be deleted when the task process is complete.
  • WaiveAssignmentEmail: set to false if you want to have an email sent out to the assignee when a task is created
  • WaiveCancelationEmail: set to false if you want to have an email sent out to the assignee when a task is canceled.

By default, all of these properties that are set to “no” or “false”, so will send emails based on the above parameters. To change, just click on the drop down next to each option and update to “yes” or “true” and the emails will stop sending!

How to fix SharePoint sites that don’t appear in top navigation

(this post applies to SharePoint 2010, 2013, 2016 classic sites)

So in this scenario, a user was unable to get new SharePoint 2010 sites to show in the top navigation, even though some where hidden. If this happens to you try the following:

  • Navigate to Site Actions > Site Settings
  • Under Look and Feel > Navigation
  • In Global Navigation > update the maximum number of dynamic items
Update the maximum number of dynamic items to show all your sites

That’s it! now all your sites that haven’t been hidden will be displayed in the global navigation.

How to show the folder path of a file in library views

Introduction

This post looks at ways in which you can show the folder path of a file as a standalone column within a SharePoint document library view.

UPDATE: I’ve updated this post after some comments asking how to do this for modern SharePoint libraries. Click here for more.

Classic SharePoint

The scenario

A common request I get is:

How do I see what folders/ sub-folders my files are in at a glance

– all users everywhere

Out of the box, there aren’t any columns available that you could potentially leverage to display this information in a standard SharePoint 2010 library.

The solution

So, just by adding one value in SharePoint Designer, here’s how you do it:

  • Navigate to the library you wish to change, create a new view under Library Tools > Library > Create View
  • Choose the relevant format of your view, give your view a name and press OK
  • Open SharePoint Designer > Open the site > open the library you were just working in
  • In the Views pane > click to open the view you just created
In SharePoint Designer, clicking on the view name will open the view in edit mode
  • In the code editor window, scroll down until you see something like the following:
<ViewFields>
	<FieldRef Name="DocIcon"/>
	<FieldRef Name="LinkFilename"/>
	<FieldRef Name="Modified"/>
	<FieldRef Name="Editor"/>
</ViewFields>
  • Add the following field reference in between the opening <ViewFields> and closing </ViewFields>
  • Add the field reference in the display order you would like it to appear in the view
Add the field reference to the View Fields list
  • Press the Save icon to save your changes
  • Press the Preview button to see your view in action in the browser

Now you will notice there is a new column being displayed “Path”, that is showing us the full location of the file or folder in the libary. You’ll also notice that this path will display data when at the library root, or in any folders or sub-folders in the library.

Library root displaying a files path
File in sub-folder displaying relative location

Bonus

Taking this one step further, what if we wanted to show files of a certain type, then create a view that groups these files by their folder location? Guess what, that’s exactly what I did!

  • Navigate to your library > create a new view as before, this time base your new view off the one you just created
  • If you wish to only show files of a particular type, use the filter by settings (for example below is filtered to only shows Word documents)
  • Make sure “show all items without folders” is selected
  • Press OK
Filtering to only show word documents, also showing items without folders
  • Back in SharePoint Designer > Open up the view you just created
  • Scroll down until you see the opening <Query> tag and add the following beneath it:
<GroupBy Collapse="FALSE" GroupLimit="30">
	<FieldRef Name="FileDirRef"/>
</GroupBy>

Save and preview your view, it should now be grouping by the Path field:

I know this has proven really useful for my company, so hopefully this helps out someone else too 🙂


Modern SharePoint

The scenario

With Microsoft retiring SharePoint 2010 designer workflows, plus the movement away from SharePoint Designer in general, a few readers have asked for a solution that works with modern SharePoint.

When researching this I considered whether suggesting to use SharePoint Designer 2013, as the above solution would still work in SharePoint Online using SPD 2013. But, as Microsoft say themselves although SPD 2013 remains supported, it’s depreciated – so I decided to go in a different direction.

The below example walks you through how you can create a flow in Power Automate to update a file after it’s been created to have the folder path shown in the document library view:

The solution

For this solution you will need to have access to create Flows in Power Automate, as well as an existing Document Library created in SharePoint Online:

  • Navigate to the document library you wish to show the folder path for
  • Add a single line of text column to the document library > give it a name (I called mine FolderPath)
  • Under the ellipsis, press Automate > Power Automate > Create a flow
  • In Power Automate, either use an existing, relevant template or start from blank
  • The trigger action should be When a file is created (properties only)
  • Set the Site Address and Library Name where you want to add the folder path
  • Insert a new step > select Update file properties.
  • Set the following values for the update file properties step:
    • Site Address: same as previous step
    • Library Name: same as previous step
    • Id: ID
    • FolderPath: Folder path

NOTE: The FolderPath within the Update file properties step is the custom column we created earlier. The Folder path (highlighted in red) is dynamic content available within the step in the flow. The folder path dynamic content is the path to the folder the item is in, relative to the site address.

Ensure you select the system Folder path dynamic content to pull the right data into the custom FolderPath column.

Here’s the flow in it’s entirety:

At this point test and save your flow to make sure it is working as expected 🙂

Bonus #1 – turn your folder path column into a hyperlink column

So if like me you want to take this one step further, wouldn’t it be good if we could easily make our newly showing folder paths, actual hyperlinks to the folders? Well the good news is you can!

  • Navigate back to your document library > click on the FolderPath column > Format this column
  • Under Apply formatting to make sure FolderPath is selected
  • Paste the following JSON into the custom formatting box:
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "a",
  "style": {
    "color": "blue",
    "font-weight": "bold"
  },
  "attributes": {
    "target": "_blank",
    "href": "='YOUR SHAREPOINT SITE URL' + @currentField"
  },
  "txtContent": "@currentField"
}

NOTE: for more information on turning field values into hyperlinks, check out this awesome sample from sp-dev-list-formatting.

  • Press Save
  • Your FolderPath column values should now be legitimate hyperlinks that click through to the relevant folders

Bonus #2 – update existing files in the document library

This was another suggestion from a reader with regards to how to update files that existed in the document library before the flow was created.

Running a flow manually for individual files

When I began to consider how to do this I started by looking at ways to manually start the flow.

It appears the only real way to do this is to create a new column that adds a button next to each file, that allows you to run the flow. I’m not really enamoured by this approach as it doesn’t seem ideal to have an extra column to run a flow showing on every file in your library. If this is something you would like to pursue then I would recommend this great article by WonderLaura who has the process of creating a button to trigger a flow covered!

Update our flow to update all files if folder path is empty

My solution to this problem was to update the flow we created earlier to get the properties for all files in the library, then add a condition that checks if the FolderPath column is empty, then if yes runs our flow as before.

  • First, I added a Get files (properties only) action which gets all the files from the source library
  • Then I added a new Condition action, which simply checks if the FolderPath column we created is equal to null. You will also notice a new Apply to each action will be created
  • I then moved the previous Apply to each action into the “If yes” condition
  • I left “If no” blank, as it is ok to leave a condition blank if you don’t want it to do anything

Here’s the updated flow in full, which changes highlighted in red:


Problems creating list or library views based on created date

The situation

Data retention and deletion…I’m sure this is a something that anyone involved in Office 365, SharePoint on information management in general gets fed up of saying since the recent GDPR legislation!

Recently we have been rationalising and cleaning up our data in preparation for moving to Office 365. We are starting with SharePoint as the first target repository or silo of content.

The general consensus is to delete files and folders over 7 years old unless there is a pre-existing data retention policy to adhere to. So the next task is to identify those files that fall within our threshold, and ultimately delete.

Luckily, we have Tree Size Pro and ShareGate so I was able to relatively easily identify the files in question (there were a lot!).

The setup

As our SharePoint environment is a) rather full; and b) rather old, I made the decision to incrementally delete files rather than en-masse to mitigate risk, targeting the lists/libraries containing the most out of date content. I started by creating a view in the first library – library A with the following parameters:

  • Standard library view
  • Filtered by Created Date if less than or equal to 01/01/2011
  • Folders or Flat: Show items inside folders
    Show this view: In all folders

(all other settings are left default)

Results this returned looked good, I could see folders and files in this view that matched the criteria – brilliant! Based on my previous statement I decided to delete in batches out of working hours, again to mitigate risk. I deleted first from library A, then from the first stage and finally from the second stage recycle bin all in this fashion.

The problem

I had permanently deleted around 50% of the total volume of content to be deleted from library A when we started to receive reports of current files being ‘missing’ from library A…not a good day.

After these reports were investigated they were indeed true. It turns out that when folders are included within a library view, folders that match the filter will be shown in the view, regardless of whether the files inside match.

We tested the view exluding folders and all the files returned matched the filter criteria. The same results were demonstrated from a SharGate report of the same nature. The report of all files over 7 years old brought back folders over 7 years old, but they also contained files that were newer.

Conclusion

At present, we are not entirely sure as to why these filters are not able to drill down past a top-level folder. It appears to be difficult to specify via view settings to only show files within folders, including the folder itself that matches the criteria.

We have decided to omitt folders from our reports and views going forward and to solely focus on files as this is the most reliable way we can delete files.

Bonus: for those of you with ShareGate, heres an example of my report we created to bring back all files over 7 years old, excluding folders. I ran this report across the entire intranet application over a weekend and it worked a treat 🙂

SG-report