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.



Wednesday, December 22, 2010

Sharepoint Foundation 2010 - Create linked lists with header detail display

This will show how to create a header-detail relationship in SharePoint Foundation 2010.  In this tutorial, we will be creating a Orders/ OrderDetails relationship.

Let’s get started:
  1.       We need to create 2 lists and link them together.
a.       Create Orders list
b.      Site Actions > View All Site Content
c.       Click “Create”
d.      Select “Custom List”
e.      Give the list a name, let us call it “Orders”
f.        Click “Create”
g.       After page reloads, click “List Settings” top right on ribbon bar
h.      Scroll down to columns, click “Title” column, so that we can edit it.
i.         (make sure “Enforce unique values is set to YES)
j.         Rename column to “OrderNumber”
k.       Click “OK”
l.         Now click “Create column”
m.    Column Name: “OrderDate”, type = “Date And Time”
n.      Click “OK”

a.       Create OrderDetails  list
b.      Site Actions > View All Site Content
c.       Click “Create”
d.      Select “Custom List”
e.      Give the list a name, let us call it “OrderDetails  ”
f.        Click “Create”
g.       After page reloads, click “List Settings” top right on ribbon bar
h.      Scroll down to columns, click “Title” column, so that we can edit it.
i.         (make sure “Enforce unique values is set to NO)
j.         Rename column to “Qty”
k.       Click “OK”
l.         Now click “Create column”
m.    Column Name: “Product”, type = “Single Line of Test” (Could also be a lookup)
n.      Click “OK”
o.      Again,  click “Create column”
p.      Column Name: “OrderNumber”, type = “Lookup (information already on this site)”
q.      Get information from, select “Orders”
r.        In this column, select “OrderNumber”
s.       (There is the relationship behaviour which can help to maintain data integrity, but it outside of the scope of this quick tutorial)
t.        Click “OK”

2.       Create an  order  and add some orderdetails.  Make sure you select the ordernumber you created in orders when adding orderdetails.

3.       Select Orders from the lists.

4.       Select Site Actions > Edit Page

5.       Under Web Part Tools, select Options

6.       Select Insert related List, click “Orderdetails”



7. Now you have setup a header detail relartionship.



ORD002 selected, showing 0 line items in order detail

ORD001 selected, showing 2 line items in order detail