In a document library in which minor version is enabled, UpdateOverwriteVersion() creates a minor version.
The thread - http://social.technet.microsoft.com/Forums/en-US/sharepointgeneral/thread/e0d1af63-3705-4b58-95c5-f0f92f86a23f - explains the similar problem and proposes the solution as turn-off the minor versioning, update the item and turn-on the minor versioning.
But, I cannot temporarily turn-off the minor versioning setting, since the same library may be in use by other users to upload/change their documents and the turning-off the setting might affect their operations.
Is there any-other solution?
Thanks and Regards,
Arjabh
If the goal is to update the fields without creating multiple versions see the code:
Microsoft.SharePoint.Client.File lp_newFile = lp_web.GetFileByServerRelativeUrl(lp_uri.LocalPath);
lp_context.Load(lp_newFile);
lp_context.ExecuteQuery();
//check out to make sure not to create multiple versions
lp_newFile.CheckOut();
ListItem lp_item = lp_newFile.ListItemAllFields;
listItem["Created"] = info.SourceFile.CreationTime;
listItem["Modified"] = info.SourceFile.LastWriteTime;
listItem.Update();
// use OverwriteCheckIn type to make sure not to create multiple versions
lp_newFile.CheckIn(string.Empty, CheckinType.OverwriteCheckIn);
Try listItem.SystemUpdate(false) instead of listItem.UpdateOverwriteVersion()
Use something like this (it works for me) :
//Disable minor versions on your list or library, if your item is in a major version (maybe use a file.Publish before)
list.EnableMinorVersions = false;
list.Update();
//Update item and overwrite your major version
ListItem lp_item = lp_newFile.ListItemAllFields;
lp_item["Created"] = info.SourceFile.CreationTime;
lp_item["Modified"] = info.SourceFile.LastWriteTime;
lp_item.UpdateOverwriteVersion();
//Enable minor versions
list.EnableMinorVersions = true;
list.Update();
Related
I'm following this article,
https://msdn.microsoft.com/en-us/magazine/mt632271.aspx
It references OneDriveClientExtensions which I can't find anywhere or any mention of where it might be. Any ideas?
Nick.
"OneDriveClientExtensions" is a part of OneDriveSDK version 1.x, but latest 2.x does not have it.
And, the article of MSDN magazine is based on OneDriveSDK version 1.x.
To follow the article, you need to pick the SDK 1.x from nuget.
https://www.nuget.org/packages/Microsoft.OneDriveSDK/1.2.0
If you use GetClientUsingOnlineIdAuthenticator method, then
replace
OneDriveClientExtensions.GetClientUsingOnlineIdAuthenticator(Scopes)
with
var onlineIdProvider = new OnlineIdAuthenticationProvider(Scopes);
await
onlineIdProvider.RestoreMostRecentFromCacheOrAuthenticateUserAsync();
var client = new
OneDriveClient("https://api.onedrive.com/v1.0",onlineIdProvider);
When using semantic versioning, can a function be removed from a project without a major version bump if that function isn't intended to be part of the public API?
Ref: http://semver.org/
Major version increment comes when you make incompatible API changes. If your function do not affect the API, then you shouldn't go for it.
If the function was ever a part of the public API, intentionally or not, then removing it is a breaking change and thus a major version increment.
I'm working in a native JEXL sandbox, so there is no need of
expression e = jexl.createExpression
Actually I am able to get this working:
foo = new ("org.apache.commons.jexl2.JexlArithmetic", false);
tmp = foo.multiply("123","123");
with those two lines I can access the var tmp.
Now I want to make a XOR operation like this:
tmp2 = foo.bitwiseXor("3","5");
This results in an error message as following:
org.apache.commons.jexl2.JexlException: unknown or ambiguous method
any ideas how to make this working?
found the answer by myself ;)
the method bitwiseXor is available only in JEXL version 2.1 and newer.
the version I am using in my sandbox is 2.0, which was a little bit hard to find out.
cheers
So I updated my Xamarin install today to the latest stable version. Since the update, my app won't run on iOS (runs fine on Android)... the error is that it can't resolve the constructor.
Autofac.Core.DependencyResolutionException: No constructors on type 'FutureState.AppCore.Migrations.Migration001' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.
My original constructor is
public Migration001(IUserRepository userRepository,
IRoleRepository roleRepository,
IPermissionRepository permissionRepository,
IPasswordHasher passwordHasher)
{
_userRepository = userRepository;
_roleRepository = roleRepository;
_permissionRepository = permissionRepository;
_passwordHasher = passwordHasher;
MigrationVersion = 1;
}
but I even tried changing it to service location just to see if Autofac would find the constructor.
public Migration001()
{
_userRepository = App.Container.Resolve<IUserRepository>();
_roleRepository = App.Container.Resolve<IRoleRepository>();
_permissionRepository = App.Container.Resolve<IPermissionRepository>();
_passwordHasher = App.Container.Resolve<IPasswordHasher>();
MigrationVersion = 1;
}
but unfortunately, it results in the exact same issue.
Autofac.Core.DependencyResolutionException: No constructors on type 'FutureState.AppCore.Migrations.Migration001' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.
what would cause something like this? This is a Xamarin.Forms app, so the exact same code is run without issue on Android.
Looks like it was an issue with the Xamarian release at that time. I've re-updated to the latest version (yesterday) and no longer have this issue.
Further there were a number of breaking bugs in the September 2014 releases, so if you're on 3.5... upgrade.
I had similar issue after upgrading Xamarin iOS SDK to Alpha (3.9.289). Changing Linker Behaviour to 'Don't link' solved my problem.
Changing Linker Behaviour to Link Framework SDKs Only solved my problem.
I'm using EntityFramework 4.3 beta version and its Data Migration facility. I wrote following code for generating a custom Migration and apply it to the DB.
MigrationScaffolder ms=new MigrationScaffolder(configuration);
ScaffoldedMigration scaffoldedMigration= ms.Scaffold("Migration");
DbMigrator dbMigrator = new DbMigrator(configuration);
dbMigrator.Update(scaffoldedMigration.MigrationId);
Scaffolding function worked fine and generated a Migration correctly.
But an exception comes up and says
"The specified target migration '201201230637551_Migration' does not
exist. Ensure that target migration refers to an existing migration
id."
Does this happen since still this is a beta version? Can someone help me to solve this.
Thank you.
This is not because you were using a beta version. MigrationScaffolder class is only to generate a configuration class. That generated file is not being added to the solution automatically. If we want to pass it into DbMigrator.Update() method, we should add the generated file into the solution first. Then we should make an instance of that class, and pass it into the update() method like this.
{
DbMigrationsConfiguration myConfiguration=new MyConfiguration();
DbMigrator dbMigrator = new DbMigrator(configuration);
dbMigrator.Update(myConfiguration);
}
Here MyConfiguration is the generated class.
Additionally, you do not need to apply migrations into your project this way. Instead you can use:
{
DbMigrationsConfiguration myConfiguration=new DbMigrationsConfiguration(){
AutomaticMigrationsEnabled = true;
AutomaticMigrationDataLossAllowed = true;
}
DbMigrator dbMigrator = new DbMigrator(configuration);
dbMigrator.Update(myConfiguration);
}