Join Webhostforasp.net
dailtcode logo

Unexpected error on server associating the workflow

clock July 5, 2008 01:04 by author mderaeve

Ever had this nice error:

I first got this error when I was migrating the workflow from development to live. I just copied the workflow and linked the list and items correctly. When I press finish it saves the changes but cannot associate the workflow with the list. The problem was because it was the first workflow on the site, there was no folder created for the workflows. A copy paste, copied the workflow in the root directory. Look for the difference in the pictures below!

This doesn't work:

This works:

In both pictures you will find a workflow folder, this was because I had taken the screen after the folder was created. But I dragged the workflow to the root and the same problem arrose. So the solution is to put the workflow in the correct workflow folder. If it does not exists yet:create a dummy workflow and the system will create the workflow folder for you. Then drag your workflow in this folder and now it can associate the workflow with the list. Remove the dummy workflow.



SPListItem.Copy()

clock July 3, 2008 06:49 by author mderaeve

This function can copy a listitem from one list to another. After a little debugging and googling I noticed that the url field has to be the complete field. The target list can contain less or more columns, it just copies the they share. Very simple implementation:

SPListItem.Copy(SPContext.Current.Web.Url + "/" + doc.Url, _publicLibUrl +doc.Name);

I made the destinationurl of the library a public property of my webpart. So I can use the webpart on any site. I'm still trying to find out if there is a possibility to overwrite documents. At first site it looks impossible. Any help on this is welcome.(workaround below) It is no problem to copy the item from one site to another on the same server.

I do this at the end of my approval workflow. When the document is approved and published, I copy it to document library on an other site, where all users have read acces. Togehter with RMS we can lock the files completely. When a reviewer changes things in the document, users won't notice it. Only after final approval, the document will be copied to the public library. This creates a working version and a published version.

Added on 8/7/2008 

So I found a workaround for the SPListItem.Copy overwrite problem. First I tried the SPFile.CoptTo. This can overwrite the file but cannot copy to another site. Then I tried the SPFileCollection, but there the overwrite problem arrose again. So now I created a simple workaround, because I don't need versions I look for and delete the file before I copy it. The versions are kept in the original library.

SPSite site = SPContext.Current.Site;

SPFile file = site.AllWebs[_sopSiteName].GetFile(_publicLibUrl + doc.Name);

if (file != null)

{   

file.Delete();

}

SPListItem.Copy(SPContext.Current.Web.Url + "/" + doc.Url, _publicLibUrl +doc.Name);

 



Open document in Edit mode: DispEx

clock June 21, 2008 09:05 by author mderaeve

Frustrating, this is what Sharepoint sometimes can be. Today I realised that the workflow I created on a document library (in Sharepoint Designer) is not able to fulfill our needs.

The story:

When you assign a Todo item, or a create task, the system creates a link to the document. When a user clicks on the link, a read only version is opened in a browser. The task should be review. So if the reviewer open the task, he clicks on the link to review the document. Then he makes changes and when he is finished, he clicks Ctrl-S, nothing happens. In the menu, only the save-as button is enabled. When he browses for the correct document library and tries to save the document, the system asks him to overwrite. He chooses Yes. Then a friendly pop up tells him the document is a read only version. Hahaha he smiles, I can start over. This is not what I had in mind. I was hoping the document could be opened(not in a browser but in Word) and saved.

So as a solution, I choose to open a link to a webpart, on which I created a link t the document. Using the DispEx function, the document is opened in Word and the reviewer only needs to press Ctrl-S and it is saved as a new version on the correct place.

Here the code:

public class OpenDoc : WebPart
    {
        string sSOPURL = null;
        string sSOPName = null;
 
        private string GetSOP()
        {
            if (String.IsNullOrEmpty(sSOPName))
            {
                sSOPName = this.Page.Request.QueryString["qSOPName"];
                if (String.IsNullOrEmpty(sSOPName))
                {
                    sSOPName = "noSOPsel";
                }
            }
            return sSOPName;
        }
 
        private string GetSOPURL()
        {
            if (String.IsNullOrEmpty(sSOPURL))
            {
                sSOPURL = this.Page.Request.QueryString["qSOPURL"];
                if (String.IsNullOrEmpty(sSOPURL))
                {
                    sSOPURL = "noSOPurl";
                }
            }
            return sSOPURL;
        }
 
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            try
            {
                if (GetSOP() == "noSOPsel")
                {
                    writer.Write("<br>");
                    writer.Write("<br>");
                    writer.Write("<center>");
                    writer.Write("To open an SOP, click below");
                    writer.Write("<br>");
                    writer.Write("<br>");
                    writer.Write("</center>");
                }
                else
                {
 
                    writer.Write("<br>");
                    writer.Write("<br>");
                    writer.Write("<center>");
                    string url = GetSOPURL();
 
                    if (url.EndsWith("doc") || url.EndsWith("docx"))
                    {
                        writer.Write("<A onfocus=\"OnLink(this)\" HREF=" + url + " onclick=
\"return DispEx(this,event,'TRUE','FALSE','TRUE','','0','SharePoint.OpenDocuments','','','',
'21','0','0','0x7fffffffffffffff')\">" + GetSOP() + "</A>");
                    }
                    else
                    {
                        writer.Write("<A target='_blank' HREF='" + url + "'>" + GetSOP() + "</A>");
                    }
                    writer.Write("<br>");
                    writer.Write("<br>");
 
                    writer.Write("<br>");
                    writer.Write("<br>");
                    writer.Write("</center>");
                    RenderChildren(writer);
 
                }
 
            }
            catch (System.Security.SecurityException x)
            {
                writer.Write("Sec Error: " + x.ToString());
            }
            catch (Exception er)
            {
                writer.Write("Error: " + er.Message);
            }
        }
    }

In the workflow I create a task for the reviewers, in the description I put a link to a page holding this webpart. The document URL and Name are provided as querystrings to this page.

 



How to configure pdf filter for WSS 3.0?

clock June 12, 2008 09:29 by author mderaeve

Follow these steps to configure the ifilter: 

First, you need to download the Adobe PDF IFilter 6.0, which you can find at this URL.  You should also get hold of a suitable Icon to use with PDFs, so that when they are listed in a document library they are easily recognisable.  There is a 17 x 17 one available on the Adobe web site here.

Once you’ve downloaded the IFilter, install it on your WSS 3.0 server, and then follow the instructions on registry settings in Microsoft KB Article 927675.  I’ve always found that providing the Adobe IFilter installed properly, the only setting I need to add is the Search Extensions. Also note re stopping and re-starting the search service at the end of this article.
Now you need to set up the Icon file. 

If you downloaded the icon file in step 1 above, you will have a file called pdficon_small.gif.  You need to copy this onto your WSS 3.0 server, into drive:\Program Files\Common FIles\Microsoft Shared\Web Server extensions\12\TEMPLATE\IMAGES.

Next you need to edit the XML file which WSS uses to link file extensions to icons.  This file is called DOCICON.XML and is located at drive:\Program Files\Common FIles\Microsoft Shared\Web Server extensions\12\TEMPLATE\XML.  Navigate to that folder and locate the file.  I would suggest making a backup copy first, then opening the file in NotePad.  You need to add a mapping key for PDFs at the bottom of the file, above the </ByExtension> closing tag.  The new key will be <Mapping Key=”pdf” Value=”pdficon_small.gif” OpenControl=”"/>  (note that XML is case sensitive so make sure you use same case as previous entries).  Then save the file.

If you already have PDFs uploaded to your WSS server I would recommend starting a full crawl.  You can do the with STSAdm, the command syntax is Stsadm -o spsearch -action fullcrawlstart .

When you notice that pdf documents are crawled and showed by the WSS search, but still the icon doesn't show up. If you triple checked the DOCICON.xml file and if the image is correct and IISRESET doesn't change a bit, then maybe this can help:

Create a new site collection. check if the pdf icons are showed in this new collection. Now return to the old site collection, normally the icons should now show up. In my case this helped!



Search service won't start

clock June 9, 2008 19:53 by author mderaeve

After you installed WSS on your server, you start configuring. At a point you want to configure the search service, but you can't find the place where you need to configure this.

In your central administration, go to the home page. Then you will find under server topology the name of the server where you installed WSS on. Click on the name and you will be forwarded to the page where you can configure the services on the server. You will notice that the search service is stopped.

When you try to configue this service, it could happen that a general error message is shown. When you click help, you'll get the default WSS help with nothing on this problem. It's hard to google for this problem because you can't find a good error explanation.

When you were lucky and found this post. Try to add the domains before the user names. In my case it solved the problem. Even if it is a local user, place the computer name before the user. To bad WSS doesn't give a simple error like: "unknown user". You don't have to do this for the SQL user when you use SQL authentication.



Search


Categories





Locations of visitors to this page

About

Mark Deraeve

Blogroll

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

This site was created by Jetro Wils and Deraeve Mark powered by BlogEngine

© Copyright 2008

Sign in