Solved

Sharepoint 2007 MOSS picturelibrary content approval

Posted on 2011-02-23
12
734 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

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. …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

636 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