Friday, July 27, 2012

SP2010 - Dynamic List filtering - without code, using just the URL

You have a list and you want to filter the list using a URL.

Normally you would do it like this:

http://myurl/sitename/listname/Forms/AllItems.aspx?FilterField1=Country&FilterValue1=America

This is great and you can extend it to include other columns by using FilterField2,FilterValue2,FilterField3,FilterValue3    and so on.

But what if you want to filter the same column with more than one value, using FilterField options will only allow one filter per column.  So in comes "FilterName and FilterMultiValue"

To use, its simple

http://myurl/sitename/listname/Forms/AllItems.aspx?FilterName=Country&FilterMultiValue=America;South Africa

BAM! you now have a filter on the same field, its an OR filter, but its still great :)

Friday, April 20, 2012

Sharepoint 2010 Event Receiver - Deploy and Remove manually

So you want to deploy an event receiver created in Visual Studio 2010 and cant!!!

Well its easy when you right-click the event receiver in VS2010 and click DEPLOY, oh how easy that makes things, butt what if you need to deploy that event receiver on another server.  Good luck with that.

Anyway, along the way, I eventually managed to do it, not without some pitfalls.  Here I describe a method that worked for me.

1. Create event receiver in VS2010

2. Right-click event receiver and click PACKAGE, the WSP file will be created in either your debug/release folder in your bin directory.

3. Copy WSP file to new server.

4. Open SharePoint Powershell

5. Run the following commands

6. Add-SPSolution -LiteralPath "path to wsp file\EventReceiverProject.wsp", you can check if it was installed using: Get-SPSolution "EventReceiverProject.wsp"

7. Install-SPSolution -Identity "EventReceiverProject.wsp"  -GACDeployment -CASPolicies

8. You will likely get an message saying admin service needs to run to Install, then just run this command: "stsadm.exe -o execadmsvcjobs"

9. Now to activate the feature, use the following command: stsadm -o activatefeature -n "EventReceiverProject2_Feature1" -url http://win-dtze75zqh6a

I discovered this at the following link http://social.technet.microsoft.com/Forums/en-AU/sharepoint2010programming/thread/5b8d6a87-1722-4dd3-af8e-767859291db9


You are done.  You can use SharePoint manager to check if you event receiver was correctly attached to your list.


To undeploy, its basically the above steps in reverse :-)


stsadm -o deactivatefeature -n "EventReceiverProject_Feature1" -url http://win-dtze75zqh6a/

Uninstall-SPSolution -Identity "EventReceiverProject.wsp"

Remove-SPSolution -Identity "EventReceiverProject.wsp"







Thursday, March 8, 2012

Sharepoint foundation 2010 - Item level permissions - filer lists in outlook

For this to work, you create the tasks list


Then open SharePoint Designer, open the list, create new workflow.


Create an impersonation step (Note: this step will run using the credentials you opened the SharePoint site with)


The following workflow is an example from some work I did, where we assign full control to only the assigned to person (or group).  I had to also add an additional step to also assign full control to another group (ADMIN), as the workflow would crash if I allowed multiple selection of groups/users for my assigned to column.




Let’s go through each step.

Set a variable equal to the Assigned to field for the current task list item


REPLACE the current task list item rights to Full Control for current Assigned To user/group.  Notice we used replace, this is important.



Then add same rights(as in B) for the ADMIN group, this is to ensure that we also have a group that we can put users into that can see everyone’s tasks.

Save the workflow, publish. Make sure you’ve set the start workflow on item create and change.  So when task is created, rights are assigned, also when task is changed, as assigned to may be changed, so we need to update the task.