Hot answers tagged

3

I asume you are filtering by site and not by library. You could do something like this: $ignoreSites = @("http://siteurl/site1", "http://siteurl/site2") Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue $siteURL = $args[0] $site = Get-SPSite($siteURL) $webs = $site.AllWebs | ? {$_.Url -notin $ignoreSites} foreach($web in $webs) { ...


2

A powershell can be written to copy files with a system update to retain the modified by and modified columns, refer link Second, check with your admin if they use any tool to move objects between environments (the one we have is Metalogix, we use for purposes like this).


2

'Replace it' will create a new version of the file if the library has versioning enabled. You can check if the old version was retained by looking at the file's Version History.


2

Single Web: [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") #get site $site = new-object Microsoft.SharePoint.SPSite("http://example.com/sitecollection/site") # get web $web = site.OpenWeb("website") # loop through all lists in web foreach ($list in $web.Lists) { # examine if BaseType of list is NOT a Document Library ...


2

As mentioned here: Introduction to versioning. By default, each major version can have up to 511 drafts (minor versions) This should still hold true for SharePoint 2013.


2

I would either built a small console app using CSOM or use PowerShell and CSOM together. I haven't checked if this code works, but it probably look something like this: using (var context = TokenHelper.GetClientContextWithAccessToken(uri.ToString(), token)) { var web = context.Web; using (var fs = new ...


1

After you get the list, enable versioning. Then load the list and call execute query async


1

Assuming that you have only major versions enabled in document library. SharePoint's default behavior is the same when you are getting the version number in REST query. The checked in version is: 6.0 After checking out it became 7.0 version. However, if you want to display the last checked in version of the file you can get that idea from ...


1

Instead of using the Relevant Documents Web Part, you could you a List View Web Part and filter the list view for the current user. Then you could easily add/remove whatever columns you want from the list view. To do this, edit the List View Web Part properties and then under Selected View click on Edit the current view. Under the Filter section, set the ...


1

I've put together a CSS-Only way to remove this message, while keeping the status messages for other scenarios (like items or pages being checked out) visible. For starters, the markup for a customized page that is also checked out looks something like this: <div id="pageStatusBar"> <span id="status_1"> <span ...


1

I had similar but more specific case. Needed to do some stuff for the first (and only the first) time document was approved. Here is what I did. Hope it helps someone. public override void ItemUpdating(SPItemEventProperties properties) { if (properties.AfterProperties["vti_doclibmodstat"] != null) { SPModerationStatusType ...


1

To avoid getting rid of data associated with the original file, you can open the file in "Open in Windows Explorer", then you can overwrite the file there. With a PDF, it maintains the ancillary information. CAUTION: It does NOT maintain with .doc files (which is annoying).


1

In O365, there is no possibility to select Version 'does not contain'. So, here is another solution. In your Document Library, create a new Calculated column Minor Version with this formula: =IF(RIGHT(Version,FIND(".",Version))=".0","Major","Minor") Then create a new view Minor Version with this filter: Show items only when the following is true: Minor ...


1

There are certain classes defined inside Microsoft.SharePoint namespace which you can use to customize your audit report. SPAudit SPAuditEntry SPAuditEventType SPAuditQuery Please look into this URL.It actually tells you about auditing and different levels of auditing in Sharepoint. ...


1

You cannot change item version properties as SPListItemVersion.this[string] indexer is read only. That is, whereas this code is legal: SPListItem item = list.GetItemById(1); item["X"] = "a"; The below code will throw error: Property or indexer 'Microsoft.SharePoint.SPListItemVersion.this[string]' cannot be assigned to -- it is read only ...


1

You can split the version label and check is the second part 0 string[] versionArray = itemVersion .VersionLabel.Split('.'); int minorVersion = Convert.ToInt32(versionArray[1]); if (minorVersion == 0) { //this is a major version } or you can check the reminder when dividing VersionId with 512 int modulo = itemVersion.VersionId % 512; if (modulo == 0) ...


1

Yes it does, but not to the degree at which versioning in SharePoint behaved in the past. Previously it would take copies of the file leading to massive space consumption if you didn't put limits on version retention, you could fill up your quota fast. Shredded Storage comes in two parts: part one is about getting the document to the Microsoft SQL ...


1

You can get the field value of a field in a particular item version using $version.item["Field Display name"] but I think it is a read only property and you cant set it via code. https://msdn.microsoft.com/EN-US/library/office/microsoft.sharepoint.splistitemversion_members.aspx


1

Library Settings and select Versioning Settings Under Document Version History section, check the option for "Keep drafts for the following number of major versions". Enter the number of versions you want to keep. Hope this helps Reference: Click here!


1

you can find the updated fields by comparing the actual version fields with the version fields before. Example code can be found here: http://charliedigital.com/2011/03/04/getting-version-changes-from-sharepoint/ Keep also a view on fields which are null and which contains equal strings. Hence I changed the foreach loop like this: foreach (SPField field in ...


1

You can access this information via the MajorVersionLimit and MajorWithMinorVersionsLimit properties of the Microsoft.SharePoint.Client.List object. For example (managed OM): string url = "http://yoursite/subweb"; using (var clientContext = new ClientContext(url)) { var web = clientContext.Web; List list = web.Lists.GetByTitle("YourDocLib"); ...


1

Unfortunately only SharePoint Online CSOM API (v.16) supports those properties currently for List object: List.MajorWithMinorVersionsLimit List.MajorVersionLimit In SharePoint On Premise, you could consider the following approach to return those properties: getListInfo('Documents', function (info) { console.log(info.MajorVersionLimit); ...


1

Correct, only the current version impacts the LVT.



Only top voted, non community-wiki answers of a minimum length are eligible