In a previous post I showed you how to uninstall a feature with Powershell. That command is going to be quite useful when you have to do some development with workflows and event receivers. Event receivers are quite stable but workflows are a different subject. Even when they are fired, sometimes they don't work in the way you expect.
Event receivers always work like you expect, just because they are a bunch of events already defined, when workflows mix 3.0 .NET WF with 3.5 .NET WF with native sharepoint 2010 modules.
The following commands will save you plenty of work, and I recommend to use them all the time, to be sure that what you are deploying is the right version of your Workflow or Event Receiver.
To enable a feature just type the following command in Powershell (replace nameofyourfeature with the name of the featurae you want to enable. Type the url where your feature lives):
Get-SPFeature | Where-Object {$_.DisplayName -eq 'nameofyourfeature '} | Enable-SPFeature -Identity {$_.Id} -Url http://myserver/sites/docs
To disable the feature just type the following command in Powershell (replace nameofyourfeature with the name of the featurae you want to enable. Type the url where your feature lives):
Get-SPFeature | Where-Object {$_.DisplayName -eq 'nameofyourfeature '} | Disable-SPFeature -Identity {$_.Id} -Url http://myserver/sites/docs
Conclusion: Powershell can beat any user interface in Sharepoint 2010. With Powershell we will be able to reach any issue we have with features. The Web UI still quite weak comparing with the power of this shell.
Monday, 7 March 2011
Thursday, 3 March 2011
The SaveAs2() Issue in MS Word 2010 and the Com Exception error.
If at some point you get an error by calling the SaveAs method in Microsoft Word when you are working with SharePoint 2010 at the same time, just do the following.
1- Deactivate all teh features,
2- Click MSWord on File->SaveAs, and type a Sharepoint Location.
3. After saving it, check in that file.
4. Close Word and open it again. It will work
This is the line of code that it could bring you some headaches:
_DocumentToBeSaved.SaveAs2(
ref _sFileName, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj);
1- Deactivate all teh features,
2- Click MSWord on File->SaveAs, and type a Sharepoint Location.
3. After saving it, check in that file.
4. Close Word and open it again. It will work
This is the line of code that it could bring you some headaches:
_DocumentToBeSaved.SaveAs2(
ref _sFileName, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj, ref _oObj);
Tuesday, 1 March 2011
How to remove a Feature (Event receivers/Workflow) from PowerShell
At some point, if you spend too much time developing workflows and event receivers, Visual Studio 2010 will probably crash when it is trying to retract the feature you are developing. You will normally get this error:
Error occurred in deployment step 'Recycle IIS Application Pool': Provider load failure sharepoint 2010
This error can be fixed in the following way (choose your favourite option, but I suggest the last one):
1- IIS RESET
* Go to the SharePoint Farm server.
* Start->Run...-> iisreset and pless enter.
2- RE-START YOUR SERVER
3- UNINSTALL THE FEATURE. (a)
* I normally list all the features to be sure that mine is there, try this command in powershell:
* Get the Id of your feature (It is a GUID so it will look like something like this :0a1f6e15-7117-47d3-81d3-1681696e40f0)
*Now you have your ID, so just call this command
4- UNINSTALL THE FEATURE. (b)
*If you know the name of the feature just apply this command (it is built from the previus one):
Error occurred in deployment step 'Recycle IIS Application Pool': Provider load failure sharepoint 2010
This error can be fixed in the following way (choose your favourite option, but I suggest the last one):
1- IIS RESET
* Go to the SharePoint Farm server.
* Start->Run...-> iisreset and pless enter.
2- RE-START YOUR SERVER
3- UNINSTALL THE FEATURE. (a)
* I normally list all the features to be sure that mine is there, try this command in powershell:
Get-SPFeature | Sort -Property DisplayName
* Get the Id of your feature (It is a GUID so it will look like something like this :0a1f6e15-7117-47d3-81d3-1681696e40f0)
*Now you have your ID, so just call this command
UnInstall-SPFeature -Identity yourid -force (ie: UnInstall-SPFeature -Identity 0a1f6e15-7117-47d3-81d3-1681696e40f0 -force)
4- UNINSTALL THE FEATURE. (b)
*If you know the name of the feature just apply this command (it is built from the previus one):
Get-SPFeature | Where-Object {$_.DisplayName -eq 'nameofthefeature'} | UnInstall-SPFeature -Identity {$_.Id} -force
Subscribe to:
Posts (Atom)