0

New to PowerShell and SharePoint, i have a sharepoint 2013 project on visual studio 2013 that contains a SharePoint List definition and instance.

After adding and installing the solution and enabling the feature, i added too many records to the list.

Now i added another column to the list (business need) and i want to update the feature (PowerShell) without loosing the records inserted before...

How can i do this please?

  • Why would you lose the record by deactivating the feature? To provide any help, we need to know the feature contents (what the feature contains? what does it to?). Does it delete the list on deactivation? – SPArchaeologist Jul 11 '14 at 13:16
  • Hello, i have a simple sharepoint 2013 on vs 2013 project containing a list definition of 4 columns. After deploying my project i added data in my list, now my need is to add another column to the list, but when i deploy from visual studio i loose all the records i have inserted, what can i do please to conserve data and update my list defintion at the same time – Haithem KAROUI Jul 14 '14 at 9:47
  • Wait... you lose the data if you deploy the solution from Visual Studio? are you sure you are not triggering Visual Studio deploy conflicts resolution? – SPArchaeologist Jul 14 '14 at 9:57
  • every time i deploy, a message from VS is shown : The url or name of this list instance conflicts with a list instance already on the server, the list instance on the server will be deleted before deploying the new instance... and i click on Resolve automatically – Haithem KAROUI Jul 14 '14 at 10:15
  • Ok, I think we have enough info now. Give me some time and I will try to wrap up an answer. – SPArchaeologist Jul 14 '14 at 10:40
1

After digging for more clarifications... i found that it was not very complicated... To perform such update

1/ In Production environment :

Just need to run Update-SPSolution cmd-let and this will do the job for you...

Or we can do the following too

1-Deactivating feature ...

2-Retracting solution ...

3-Deleting solution ...

4-Adding solution ...

5-Deploying solution ...

6-Activating feature ...

2/ In Dev environment :

You can set the Deployment Conflict Resolution property of the list instance in the Solution Explorer to None. Simply right-click on the list instance project item in VS and select Properties. Then select None from the dropdown list

Here is a link for more informations: http://michaelbrockman.wordpress.com/2010/11/10/deployment-conflict-resolution-in-visual-studio/

0

Based on your question and following comments, I believe we actually point out two different aspect of your problem.

First - why you lose the data. Short answer: because you told VS to do that.
When you debug a solution from Visual Studio, some background check are performed to ensure that the artefact in the solution do not conflict with some artefact already present in the target web site / site collection. If any conflict is found Visual Studio will try to resolve it, based on the specific solution settings (auto resolve, ask, never do anything etc, you can chose it in the solution properties).

What does that mean? Suppose your solution provision a list instance. When you redeploy the solution, VS will perform its checks and find a list with the same name of a list the solution will create. Since that would cause a conflict, it will behave as it is currently configured to do. In your case this result in asking the user what to do.

This also means that since this behaviour is just a Visual Studio feature to support (or most of the time hurt) development, you won't see it when you deploy your code to an actual test/production environment and perform your deployment activities outside VS.

You may then ask how to manage conflicts when manually deploying - and that's is the second point I am going to make. The answer is that sadly there isn't a silver bullet approach: it just depends on the situation you need to handle.
You seem to have problems adding some additional columns to the list. Assuming you are using content type the best bet would be to simply update the CT in the solution - if the list content types are still uncustomized this should be most of the time enough to propagate the update, if that's not the case you can resort to manually push down the changes in a feature receiver. Otherwise, have a look at Feature Upgrading - this post on Chris blog is a good starting point. By using feature upgrades you can write custom upgrade code to manage almost any need you may have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.