November 2008
M T W T F S S
« Oct   Dec »
 12
3456789
10111213141516
17181920212223
24252627282930

Archive for November, 2008

11
Nov

Make all Publishing Images document libraries anonymous reading ready.

 I wrote this when I needed to make all of my images folders purely anonymous reading. I dont want to ever run into an issue of an image that is not checked in. Create a console app and replace the main with the code below. It will crawl the whole site and make all images (publishing images) fully anonymous for reading.

 
 static void Main(string[] args)
        {
            bool requireApproval = false;
            // open the site
            SPSite site = new SPSite(http://YOUR_SITE);
            // open the web
            SPWeb web = site.OpenWeb();
            ProcessWeb(web, requireApproval);
            return;
            // open the web collection
            SPWebCollection webcoll = web.Webs;
            // parse through the webs
            foreach (SPWeb webx in webcoll)
            {
                ProcessWeb(webx, requireApproval);
            }
            Console.Read();
        }
        public static void ProcessWeb(SPWeb webx, bool requireApproval)
        {
            Console.Write("Processing " + webx.Url + "\n");
            // get the list
            SPListCollection lists = webx.Lists;
            // looks for our Pages list
            foreach (SPList siteList in lists)
            {
                if (siteList.Title == "Images")
                {
                    //PublishingWeb pweb = PublishingWeb.GetPublishingWeb(webx);
                    //PublishingPageCollection ppages = pweb.GetPublishingPages();
                    bool fixSite = false;
                    siteList.EnableModeration = false;
                    siteList.ForceCheckout = false;
                    siteList.AllowEveryoneViewItems = false;
                    siteList.DraftVersionVisibility = DraftVisibilityType.Reader;
                    siteList.Update();
                    fixSite = true;
                    if (siteList.WorkflowAssociations.Count > 1)
                    {
                        SPWorkflowAssociationCollection wfCol = siteList.WorkflowAssociations;
                        SPWorkflowAssociation wf = wfCol.GetAssociationByName("Parallel Approval", System.Globalization.CultureInfo.CurrentCulture);
                        wf.Enabled = false;
                        siteList.UpdateWorkflowAssociation(wf);
                    }
                }
            }
            if (webx.Webs.Count > 0)
            {
                foreach (SPWeb webNext in webx.Webs)
                {
                    ProcessWeb(webNext, requireApproval);
                }
            }
        }
11
Nov

Creating a custom 404 page in MOSS. Thanks for making it easy MS. Grrr

Great article here wtih all the details. Only thing I would say is dont make a Virtual Directory if you are running the Ajax extentions with RAD controls. It will blow up for DLL’s missing.

10
Nov

Great little diddy for turning on IIS compression with out editing meta file

Got it from here. 

============================
CD C:\Inetpub\AdminScripts\ [Enter]

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcFileExtensions “htm” “html” “txt” “ppt” “xls” “xml” “pdf” “xslt” “doc” “xsl” “htc” “js” “css” [Enter]

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcFileExtensions “htm” “html” “txt” “ppt” “xls” “xml” “pdf” “xslt” “doc” “xsl” “htc” “js” “css” [Enter]

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions “asp” “dll” “exe” “aspx” “asmx” “ashx” [Enter]

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions “asp” “dll” “exe” “aspx” “asmx” [Enter]

IISreset.exe /restart [Enter]

Then right click on WebSites > Properties > Enable compression on static files and applications.

05
Nov

Adding style to Rad Editor for Moss

I recently had to use the Rad Editor for Moss to fix a problem with enabling Javascript in content pages of a publishing site. But once you do you quickly find out that Rad wraps their control in a iFrame and a new <html><body> tag. This as you know kills all the style from your parent site. If you want WYSIWYG you need to reenable your styles.

Quick fix - Go to the directory C:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\5.2.3.0__1f131a624888eeed\Resources and add a file called “CssEditor.css”. Add the style from your site that you need (body, a, line-height, color, etc..). When the Editor renders in design mode it will pick the file up and add it to the inner head tag.

Ta Da.

 Now what if you have multiple sites and want css files for each of them or even diffent style for different page layouts? Hmm no answer yet on that one.

Telerik Link