Solved

Sharepoint 2007 MOSS picturelibrary content approval

Posted on 2011-02-23
12
731 Views
Last Modified: 2012-05-11
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
Comment
Question by:iDOTNETCoder
  • 6
  • 6
12 Comments
 
LVL 12

Expert Comment

by:mwochnick
ID: 34967283
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
 

Author Comment

by:iDOTNETCoder
ID: 34970105

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
 
LVL 12

Expert Comment

by:mwochnick
ID: 34971388
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
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.

 
LVL 12

Expert Comment

by:mwochnick
ID: 34971595
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
 

Author Comment

by:iDOTNETCoder
ID: 34971864
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
 
LVL 12

Expert Comment

by:mwochnick
ID: 34972835
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
 

Author Comment

by:iDOTNETCoder
ID: 34973039
Hi, mwochnick

I think I need to use the Author field.

How do I do that?
0
 

Author Comment

by:iDOTNETCoder
ID: 34973477
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
 
LVL 12

Expert Comment

by:mwochnick
ID: 34974389
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
 

Author Comment

by:iDOTNETCoder
ID: 34993156
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
 
LVL 12

Accepted Solution

by:
mwochnick earned 500 total points
ID: 34998234
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
 

Author Comment

by:iDOTNETCoder
ID: 34999569
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

Featured Post

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.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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