Solved

Set audience targeting programmatically

Posted on 2010-11-30
14
1,930 Views
Last Modified: 2012-05-10
someone pointed me to this blog but I still need further guidance:
http://www.sharepointkings.com/2010/02/set-audience-targeting-programmatically.html

I don't understand where to put the code snippet in the post.

also I don't understand what this means:
"We first take our web context and then take out the default.aspx web parts..."

Am I editing something in designer?
0
Comment
Question by:sullisnyc44
  • 10
  • 4
14 Comments
 
LVL 17

Accepted Solution

by:
GreatGerm earned 500 total points
ID: 34241935
That example would be with Visual Studio, but it may be more simple than that.

What version of SharePoint are you running?
What are you trying to change the audience targeting for (items, webparts, etc)?
0
 

Author Comment

by:sullisnyc44
ID: 34242334
moss 2007 wss 3.0

just trying to restrict acces to a particular view. someone suggested audience targeting and dvwp.

I have an attendance list that I need to restrict access to items (not always determined by the Author or Create By user)

I have filtered all of the views based on [Me]

but I need to mangers to be able to view All Items.
0
 
LVL 17

Assisted Solution

by:GreatGerm
GreatGerm earned 500 total points
ID: 34242467
Ah, unfortunately, audience targeting probably won't give you the end result that you are looking for since it really doesn't keep anybody from looking at the items if they want to and have a basic knowledge of SharePoint.  What you really need to do is use the permissions structure.  Thanks to great project (http://spdactivities.codeplex.com/) you can actually just set this via a SharePoint Designer workflow.  

These are easy to setup and walk you through most of it.  The one thing you will need to decide on is how to determine who is permissioned.  It can be during the creation of the item (as a column) or via the workflow itself.
0
 

Author Comment

by:sullisnyc44
ID: 34248358
yeah  - the unfortunate thing about that project is that there is NO SUPPORT.

I believe (according to the discussions that there are issues when setting multiple permissions.

Have you used it? I need the following things to happen:
1. the authorizedBy people picker single field value needs to have permission to submit the item
2. the requestedby people picker single field value needs to have permission to edit and approve the item
3. a sharepoint group created on the site called 'Attendance Managers' needs to have access to the item (basically all items)

If you have set item permissions using to multiple values, including a group.
0
 
LVL 17

Assisted Solution

by:GreatGerm
GreatGerm earned 500 total points
ID: 34249397
I've used it quite a bit since it does simplify some common tasks and haven't run into any issues.

In response to your points:

1. Wouldn't this be the person that is creating the item in the first place?  If so, then the item already has the data of who created.
2. This would be where your would have the workflow change the permissions.
3. As long as the group has access at the list level then it will stay that way unless you take the permissions away at the item level.
0
 

Author Comment

by:sullisnyc44
ID: 34249956
nope - not always the creator

how should my permissions be set up then?

I have read access - all items (get an error about folders if I change it)
edit - only their own
0
 

Author Comment

by:sullisnyc44
ID: 34249970
how do I remove the default access to view by everyone?
remove access for visitors?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:sullisnyc44
ID: 34250033
plus if I right click and look at Manage Permissions, nothing has changed.

on workflow step I added delete permission assignment for Home Visitors...

and everyone can still see everything
0
 

Author Comment

by:sullisnyc44
ID: 34250056
this is my workflow step
item permissions
0
 
LVL 17

Assisted Solution

by:GreatGerm
GreatGerm earned 500 total points
ID: 34250700
The permissions work by granting access. If a user or group isn't listed and granted access, the they won't be able to see anything. It sounds like you'll need two groups: one for the 'Attendance Managers' so they can see the items and one for the people that need to be create the items in the first place.

The workflow should be working fine as long as you are identifying the correct item in the list.
0
 

Author Comment

by:sullisnyc44
ID: 34253587
hmmm do you thing the issue is with 'Absences'? Is it somehow not grabbing the item id?
0
 

Author Comment

by:sullisnyc44
ID: 34253606
I just changed it from 'current item' to this on the Delete permission step...

 i think this is wrong :(
0
 

Author Comment

by:sullisnyc44
ID: 34253867
I think I finally have something (kind of) working!

I DID have to change the Requested By to Contributer and not reader but that makes sense. might also have something to do with because I was both the requester and manager name.

Maybe I will just write another workflow 'when the item has changed' if I don't want to let the user edit the the request again... that I will figure out.

I WAS getting this error on the workflow, but it IS changing permisions:
Status:   Failed on Start (retrying)  

but once I changed requested by to Contribute instead of reader it fixed this issue.

HERE IS MY LOG:
Absence Type: Pending Approval
Email Manager
removing attendance requesters
Grant Contribute Permission on Absences to Attendance Managers
Granted CONTRIBUTE permission to Manager:  domain\username
Granted CONTRIBUTE permission to Requester:  domain\username
workflow complete

I really can't thank you enough - this REALLY helped me out.
0
 

Author Comment

by:sullisnyc44
ID: 34253878
here is what the final step of my workflow looks like set item permissions
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
The Scenario: Let’s say you have a quote worksheet in Excel that you use to work up sales figures and such for your clients. You utilize SharePoint to manage and keep track of these documents. You would like values from your worksheet to populate Sh…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now