• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 744
  • Last Modified:

Sharepoint 2007 MOSS picturelibrary content approval

I need to create a content approval on a picturelibrary list and have the content approval work just like a DocumentLibrary works.

I am using Sharepoint 2007 MOSS.

The situation is the PictureLibrary already exists and has tons of pictures in it.

I need to create a way for when a picture is uploaded the user who uploaded the picture can see the picture, but no one else besides the user who uploaded it and the approvers who can  accept and approve the image can see it.
Then after the images is approved all users can see the image.

All this needs to be done in an existing picturelibrary.
The List has  a column in it that indicates it has been approved or not.

Overall, I would like to create a content approval on a picturelibrary, but a picturelibary doesn't seem to have this option.

How do I go about doing what I need?

The solution for the site is in Visual Studio 2008 all code is in C#.
0
iDOTNETCoder
Asked:
iDOTNETCoder
  • 6
  • 6
1 Solution
 
mwochnickCommented:
so there are a couple of things that you need to do
1. create a some views
 -one that only shows approved content - this should be the default
 -one that show my uploaded content - you can make this all mine or just mine that is not approved - use the created by field
- one that shows all unapproved content - this one you will have to modify so that only those that are in an approver group can see any items
2. create an approver permissions group and assign approvers to it. And only allow these users to see and change the approval status field.  No body else should be able to see this.  A way to do this would be to manage the permissions on the doc library separate from the site.

You could also create a workflow to manage state, notify users if your situation is more complicated than it appears here.

Note that most of this could be done just using the sharepoint UI or you could do it in VS.  
0
 
iDOTNETCoderAuthor Commented:

Mwochnick:

Thank you for your reploy.

You stated:

"one that shows all unapproved content - this one you will have to modify so that only those that are in an approver group can see any items"

How can I create a view to do this? What would the query be using to filter just for the approvers?

2. create an approver permissions group and assign approvers to it. And only allow these users to see and change the approval status field.  
I understand and know how to create the group in AD and assign users to it, but how do I allow only users in this group to see the approval status field in the view.
What would the query be doing?


You Stated: "No body else should be able to see this.  A way to do this would be to manage the permissions on the doc library separate from the site."

What do you mean by this?

Key Point, this is not a doc library, I wish it was. This is a picture library, and picture libraries do not have out of the box content approval. I want to create the same out of the box content approval on a picture library. that a doc library has.

Also, I like to do everything in VS if possible.


0
 
mwochnickCommented:
First I'll answer your workflow question
Picture libraries are no different that document libraries when it comes to workflows - if you look at the picture library settings and then the workflow settings you can setup an approval workflow just like you can for a document library.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
mwochnickCommented:
When you ask about what the query would be doing? are you looking at sql or are you wondering what classes to use in the SDK?
0
 
iDOTNETCoderAuthor Commented:
Hi, mwochnick

Thanks for your reply.

About the query.

What does a caml query look like that uses the created by field?

For the SDK one:
I will need to check if a user is an approver, for a list.



0
 
mwochnickCommented:
have you looked at this tool http://spcamlviewer.codeplex.com/?  Lets you look at the field names for caml queries

Created by caml query
<Eq>
                <FieldRef Name='Created_x0020_By'/>
                <Value Type='Text'>domain\\username</Value>
</Eq>
in the above you would need to get the domain\\userfrom the SPUser - note that this field name is specific to document libraries for the document in the library - not sure if it applies to picture libraries but I'm guessing it does.
0
 
iDOTNETCoderAuthor Commented:
Hi, mwochnick

I think I need to use the Author field.

How do I do that?
0
 
iDOTNETCoderAuthor Commented:
Mwochnik,

I figured out how to use author.

<Where>
<Eq>
<FieldRef Name='Author' LookupId='TRUE' />
<Value Type='Integer'>4</Value>
</Eq>
</Where>

SPContext.CurrentUser.ID will give me the ID.


Now I need to figure out how to allow appovers in a group to approve the pictures.

I can have one approver, but not a group as an approver.

When I mouse over an image for a user that is in a group of approvers.
I select approve, I receive an error.
Task Update was not accepted.

I how do I fix this?
0
 
mwochnickCommented:
So you would first need to create a Sharepoint permission group that your users belong to.
then you could use SPUser to determine if they are a member of the approver group or not.

SPUser.Groups contains a SPGroupCollection which has the groups the user belongs to
SPGroup has a name that you could compare to the name of your approver group
0
 
iDOTNETCoderAuthor Commented:
mwochnick:

Okay, thanks.

What we have now is a workflow approval created.
We have an event receiver that is firing when an approver hits the approve button.
We have the approver set as a group.

The situation is when an item is added to the list, the workflow creates a worflow for each approver in the group to approver for the same item.

In the event receiver when I run through it, when one approver approves a workflow for an item.
The status of the workflow is stuck inprogress until all the approvers in the group approve their assigned workflow for the same item.
I don't want this.

I need to change this.

I need to have the item approved by the first approver in the group and delete all the other workflow tasks that are associted to the same item, which are assigned to other approvers. This would allow the approver in the group who approves the item first to allow the item to be approved.

I don't need all the approvers to approver the item to allow it to be approver.
I only need one approver to approve it and that is the first approver who gets to the workflow task first. So before the item status indicates inprogress, I want to delete all the other workflows assocaited to the same item. Then have the workflow get approved or rejected, without it being inprogress.


Can I do this in the event receiver by tapping into the SPWorkFlow and the SPWorkFlowItem?

In the event receiver it already gets the item, so what I need from you is the C# code that will allow me to delete all workflow tasks that are associated to the same item that is waiting for the other approvers.
0
 
mwochnickCommented:
Another way to look at this would be to create an additional state in a work flow that when a new item is created it changes the state to ready to approve.  it sends an email to the approvers group notifying them that an item is ready for approval.
Then when an approver views the list they then can acquire the item - like checking it out for approval - and then only they can approve it. or you could have a button that acquires and approves in one step

I seem to remember that there was a setting on the approval work flow to only require only a single approval - need to research this though its a vague recollection :]
0
 
iDOTNETCoderAuthor Commented:
mwochnick:

Yes, there is a setting.

The setting is the following:

Assign a single task to each group entered (Do not expand groups).


Overall, the key settings that matter are the following:

One participant at a time (serial)


Reassign the task to another person

Request a change before completing the task

Assign a single task to each group entered (Do not expand groups).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now