Solved

Sharepoint 2007 MOSS picturelibrary content approval

Posted on 2011-02-23
12
729 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
Comment Utility
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
Comment Utility

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

Expert Comment

by:mwochnick
Comment Utility
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
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:iDOTNETCoder
Comment Utility
Hi, mwochnick

I think I need to use the Author field.

How do I do that?
0
 

Author Comment

by:iDOTNETCoder
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Pimping Sharepoint 2007 without Server-Side Code Part 1 One of my biggest frustrations with Sharepoint 2007 in the corporate world is that while good-intentioned managers lock down the more interesting capabilities of Sharepoint programming in…
We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

11 Experts available now in Live!

Get 1:1 Help Now