SharePoint Online Recycle Bin Copy/Backup - sharepoint

This might be a odd question but is it possible at all to make a backup or copy of my Recycle Bin, if not possible no worries.
Reason for asking : Some people deletes file and remembers 100days later they accidently deleted the file, then it's a bit harder to get back the file just from restoring the file from the recycle bin.
Thanks.

You could do that using CSOM or SSOM.
CSOM:
From code you can access Web.RecycleBin property that is collection of type RecycleBinItemCollection.

Related

Kentico 8.2 - Is there a way to delete Attachment History from the GUI

Our attachments have been stored in our database for a very long time, and it has caused the database to become huge and our backups to be extremely unreliable. We have moved our attachments to the file system and that shaved off a great deal of size.
Now our largest table is CMS_AttachmentHistory. I've been able to test brute force deleting every row in SQL (and every row in the CMS_VersionAttachment junction table). But is there a way to accomplish this in the Kentico Admin GUI without having to resort to this?
When I say brute force delete, I mean:
DELETE FROM dbo.CMS_VersionAttachment
DELETE FROM dbo.CMS_AttachmentHistory
There is an option in the GUI that will do this, but it's also going to impact the page version history. If you go to Settings > Content > Content management and look in the Workflow section, you can see a setting named Version history length. Reducing this to a lower number (I believe 20 is the default) will reduce the version history stored to reflect the new value by deleting the unneeded rows.
This will affect all version history though, not just the attachment, but also the pages themselves. That being the case, you would need to decide if you need/want to keep the version history of the pages or not.
If you don't want to lose that history, then I'd say that a good option would be to write a script that can set the AttachmentBinary column to null for the records that you don't need/want (given that you say that you now store the files on the filesystem, any current versions will have the correct value, so this is probably all of them)
Not sure about 8.2. But you can try to experiment with recycle bin/objects. There are a couple topics: topic 1 and topic 2. I just check it puts there attachment every time you delete it, even though I have in setting "files on disc". You can do like Kentico recommends set binary field to null or write script using API.

SharePoint 2007/2010 issues copying lists with hidden files using MetaVis

I'm working on migrating SharePoint lists (using MetaVis Migrator) and running into issues with files that seem to end in .000 files extension. Near as I can tell this was sometimes a temp file in SharePoint. (I'm not an SP expert)
Anyway, these files seem to be preventing me from migrating/copying lists using MetaVis. Anyone know if you can get rid of these or where they live?
Thanks,
Jes
These extensions look more like items than documents. Try to copy them using item level copy that will let you to select content type in the destination list. You can contact support#metavistech.com so someone will guide you through the process.
Good luck with you migration,
Mark

How to delete a file from a library without deleting the recycled version programatically in MOSS2007

I am facing an issue where-in SPFile.Delete() is deleting all my versions of the file even from the recycle bin. I do not want the file version which is there in the Recycle Bin to be deleted.
For Example : I have created 4 versions of the same file xyz.xls. Now I delete the 2nd version of the file from the UI. This send my 2nd version to the Recycle Bin. Now what I need is that when I call SPFile.Delete(), it should delete the 4 other versions of the file and not the one that is in the recycle bin. Currently it is deleting the version in the recycle bin also.
What I have to achieve is that the version of the file which is present in the Recycle Bin should not get deleted. Only the versions present in the library should get deleted when I call SPFile.Delete().
The solution mentioned at some places to use .Recycle() will just move all the versions to the recycle bin. But what I need is that the versions of the file that are present in the library should permanentlly get deleted whereas the version of the file present in the Recycle Bin should not get deleted at all.
You can loop through file's versions and delete them one by one. It will probably be slower but I think it will achieve what you are looking for
foreach(SPFileVersion version in file.Versions)
{
version.Delete()
}
This way you will delete only version that are currently in the file and not in the Recycle Bin.

What is a difference between DeleteObject() and Recycle() methods for SP.Folder

Could anybody help me to understand a difference between DeleteObject() and Recycle() methods for SP.Folder?
I found this documentation, but it's not clear for me.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.recycle.aspx
Delete()
delete permanently without using the recycle bin.
to move item to recycle bin use
Recycle();
http://nickgrattan.wordpress.com/2007/10/09/spfolder-splist-deleting-versus-recycling/
SharePoint maintains a recycle bin like a windows OS, that we can use it through our code for temporary deletion. I used Recycle() in one of our project. When we use Delete() or DeleteObject() it deletes the item directly without putting them in recycle bin but if you use Recycle() method it will send the item in recycle bin.
Shiv Tomar
Shiv.Tomar#tekritisoftware.com
http://www.tekritisoftware.com/brochure/Microsoft-Sharepoint-Development

When is SPFile.Properties != to SPFile.Item.Properties in SharePoint?

One of our customers has a problem that we cannot reproduce. We programmatically copy a document's properties to a destination file using SPFile.Properties. However, for some reason the file's properties do not match the meta data specified on the list the file is stored in.
Now, we can probably solve this by copying SPFile.Item.Properties (not tested yet), but I am just wondering under what circumstances SPFile.Properties is unequal to SPFile.Item.Properties.
Update: We have just received an update from our customer. Using SPFile.Item.Properties always returns the up to date information. However, we still would like to understand the original question.
There is a slight difference between SPFile.Properties and SPFile.Item fields and the first one is much, much slower to call.
You have most probably seen Microsoft Office document's "properties" window (this one - http://dradisframework.org/images/tutorial/custom_document_properties.png). These are the properties that are read when you access SPFile.Properties. Reading them is slow since there is some code infrastructure that parses the binary DOC file and finds the properties. (takes up to 30 or something milliseconds for every property access) See more here: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.properties.aspx
In SharePoint, every item is an SPListItem and its field values (and I don't use the word "properties" on purpose here) are stored in Sharepoint's content database. So, when you access SPFile.Item.Properties, you actually look at the SPListItem to which the file is attached and look at its properties from SharePoint's content database.
What happens behind the scene, when you upload a file having some "Office properties" set, is that SharePoint copies them to same-named fields in SPListItem. (Some information about it here: http://weblogs.asp.net/bsimser/archive/2004/11/22/267846.aspx)
This is why these properties typically have the same value, BUT it only happens if SharePoint knows how to read metadata from your file and write them back. So, in case you put a .txt file in your SharePoint store, you will not get any SPFile.Properties back.
The user will always see the ListItem Properties and not the SPFile properties in a document library. So using the ListItem properties in the copy is the way to go.
I believe this issue is related to the Sharepoint property promotion/demotion feature which enables document properties to be embedded in the physical MSOffice file and travel with it to the client etc. This however is only supported currently for Office file types (to my knowledge).
Jonathan
Trying to find the "official documented" anything for sharepoint is pretty much undoable. :-D. The online docs suck, you are better of using blog entries etc.
P.S. I agree with Alex here. Although an SPFile never exists in a list without an accompanying SPListItem, the connection between the 2 can get corrupted (i.e. being able to edit the list item but the file is not openable). This to me indicates information about the 2 is stored in different locations in the content db. I have had this happen before.

Resources