Unpublished View

Applies To: SharePoint

Versioning is a great feature in SharePoint but can cause administrators headaches when it comes to something like branding or other resource files. I’ve previously shown you how to automatically publish a major version and to approve documents as your solution deploys. In a perfect world you’ll never touch these files except through your solution.

However, sometimes you’ll need to quickly fix something or tweak something and you end up in a common situation: You can see the change but no one else can. This happens when versioning is turned on and you either haven’t published a major version (versions below 1) or the changes you’ve made are in draft state (ie 1.1 instead of 2.0).

Tracking these down can be frustrating since everything works for those with the right permissions. So here’s a quick view to add to your library to help you identify these problems. We’ll be filtering the library on 2 columns: Approval Status and Checked Out To.

First thing to do is to create a new view (I’ve named mine Unpublished). Choose whatever columns you want but some helpful ones are Type, Name, Modified, Modified By, Checked Out To and Version. You’ll also want to scroll down to the Folders settings and choose Show all items without folders.

You’ll notice that your view is now showing everything in a giant list because we didn’t apply any kind of filter. The reason for this is that the browser based view editor won’t let us select either IsNotNull as our comparison type or the Approval Status column. Fortunately, both of these things can be done very easily in SharePoint Designer. So switch to the Library ribbon and choose Modify in SharePoint Designer (Advanced) from the Modify View dropdown.

In the Code view just paste the following into your View’s XML inside the Query element:

<Where>
	<Or>
		<Eq>
			<FieldRef Name="_ModerationStatus"/>
			<Value Type="ModStat">Draft</Value>
		</Eq>
		<IsNotNull>
			<FieldRef Name="CheckoutUser"/>
		</IsNotNull>
	</Or>
</Where>

Things should look similar to this:

ViewCAML

What our view is doing is showing any files that are checked out (so the CheckoutUser column is not blank) or that don’t have a major version. For whatever reason Microsoft won’t give you easy access to the _ModerationStatus column unless your library is requiring approvals, but we can still use it. When it’s set to Draft then it’s a minor version.

Save and refresh in the browser and you should only see those documents that may be causing you problems. Check them in or Publish a Major Version as needed and things should be good. We’ve found this simple view to be very helpful, hopefully you do as well.

Deleting a Document from a Record Library

Applies To: SharePoint 2010

In setting up a Records Center I was trying out the Content Organizer and Drop Off Library. I configured a Send To location and an Organizer Rule to get my document to my new Record Library. It worked great! However, since this was just a test to make sure everything mapped over correctly, I wanted to delete the test document and I got this error:

This item cannot be deleted, moved, or renamed because it is either on hold or is a record which blocks deletion.
This item cannot be deleted, moved, or renamed because it is either on hold or is a record which blocks deletion.

Uh… so how do I undeclare it? The answer is that with record libraries, all documents are not only automatically declared records, manual declaration/undeclaration is disabled by default. This all makes sense considering this is in the Record Center and it is a Record Library. But to delete your document, you will have to disable these settings (Temporarily).

1. Turn off Automatic Record Declaration

Go to your Library Settings for your Record Library. Under Permissions and Management choose Record declaration settings:

Uncheck the box in the Automatic Declaration section then press OK:

2. Enable Manual Declaration of Records

Go back into the Record declaration settings since the Manaual Record Declaration Availablity section will now be enabled. Choose Always allow the manual declaration of records:

3. Undeclare the Document as a Record

Go back to the Library and choose the document you want to delete. In the drop down menu, choose Compliance Details:

In order to remove the document, it can’t be a record nor be part of any holds. In the compliance details popup remove the document from hold (if necessary) and click the Undeclare record link. In the confirmation dialog choose OK to undeclare.

4. Delete the Document

Kill that sucker.

5. Put Everything Back in Place

Those settings were on the library for a good reason. Once you’ve finished your testing or no longer need to delete any individual records, you should go back to your library settings and reenable the default settings (Follow these steps backward).

If for some reason, you want to delete the Record Library itself. You will need to remove every record from the library following the above steps and then run the “Hold Processing and Reporting” job in Central Admin. This let’s SharePoint know there are no records in there and the standard deletion link will appear in the Library Settings.