February 2012
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
272829  

Author Archive for Chris Auer



07
May

Access denied on search crawl for SharePoint 2007

I have no idea why, but more and more I am seeing search crawls result in error of “access is denied”. The issue is that the web server is not allowing authentication to sites that are localhost (or local). The fix is simple, but I wish I knew why this was creeping up more.

Fix is here

In short do the follow. The reboot is necessary.

Method 2: Disable the loopback check

Follow these steps:

  1. Click Start, click Run, type regedit, and then click OK.
  2. In Registry Editor, locate and then click the following registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
  3. Right-click Lsa, point to New, and then click DWORD Value.
  4. Type DisableLoopbackCheck, and then press ENTER.
  5. Right-click DisableLoopbackCheck, and then click Modify.
  6. In the Value data box, type 1, and then click OK.
  7. Quit Registry Editor, and then restart your computer.
30
Apr

Register .NET user for an App Pool

Sometime in a non AD environment you need a user to run an App Pool so you can do cross server work (i.e. SQL). Before you can use the user in the App Pool identity you have to tell ASP.NET that they should be allow to run ASP.NET.

Simple command to run from the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 directory

aspnet_regiis.exe –ga [UserName]

 

This will tell ASP.NET to allow this user to access temp directories and the assembly code.

23
Mar

User cannot be found

User cannot be found.   at Microsoft.SharePoint.SPUserCollection.GetByID(Int32 id)
   at Microsoft.SharePoint.Publishing.CommonUtilities.LookUpUser(SPWeb web, String userLookupValue)
   at Microsoft.SharePoint.Publishing.CommonUtilities.GetUserFieldValue(SPListItem item, Guid fieldId)
   at Microsoft.SharePoint.Publishing.PublishingPage.get_Contact()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.PageSettingsPage.LoadValues()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.OnLoad(EventArgs e)
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.PageSettingsPage.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

An odd thing can happened in SharePoint. If you add a user named Joe Smith to a server, then add that user to SharePoint. Later you need to completely remove that user. So you delete the user from the server and you completely remove the user from sharepoint. (removed them from the user collection, not just the site)

One day comes and low and behold you need to add Joe Smith to the server again. You create a new user account for Joe on the server and add Joe to SharePoint. The only issue is that SharePoint doesnt resurrect the user from SharePoint. It creates a new one. And now when you are in a page that was originally created by the 1st Joe Smith you get the error above. Yippy.

If you run the SQL below you will find the two Joe Smith accounts.

SELECT * FROM UserInfo WHERE tp_Login = ‘MYSERVER\Joe.Smith’

You will get results like this

 

No User SQL

No User SQL

 The field tp_ID is the SharePoint UserID. The field sp_Deleted tells SharePoint if the user has been deleted. When you manually flag a user as deleted, all you have to do is to put the user’s ID in the tp_Deleted field. Notice that the user 19 has 19 in the tp_Deleted field.

So to resurrect the user 19 I need to kill user 16 since they both have the same username. The way I do that is simple

UPDATE UserInfo SET tp_Deleted = 16 WHERE tp_ID = ‘16′
UPDATE UserInfo SET tp_Deleted = 0 WHERE tp_ID = ‘19′
 

The SQL above will set user 16 to deleted by adding 16 to their tp_Deleted field. Changing user 19’s tp_Deleted field to 19 makes them active and all pages will work when you try and view page properties.

 

 

 

 

I hope this help anyone who runs into the same issue. I was a pain to try and diagnose why it wouldnt work and I think there is a fix for it coming from MS. But this server is on SP1 and it still does it.
NOTE: This sinerio will work if you just delete a user from SharePoint completely and need to edit their pages. Just put a "0" in the tp_deleted.
17
Feb

Quick tool to export information out of Active Directory

I had a task to rip all the email addresses and usernames out of my Active Directory for our client extranet. I thought what a pain, thinking I was going to have to write some app that will use LDAP and query to get Directory objects that I could rip information from. But ta da I found this little diddy that gave me what I wanted. Its not powerfull and is limited to only a few fields, but they are important fields that we all need. Enjoy.

http://confluence.atlassian.com/display/JIRAEXT/How+to+export+a+list+of+users+from+Active+Directory

23
Dec

Great tool for testing VT technology of your server

Just run the tool from here to see if your server or PC can support virtual technology and allow your virtual servers directly access your hardware.

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

20
Oct

Kill all connections to a Database

declare @execSql varchar(1000), @databaseName varchar(100)
set @databaseName = ‘MSCS_CMX_STG’
set @execSql = ”
select @execSql = @execSql + ‘kill ‘ + convert(char(10), spid) + ‘ ‘
from master.dbo.sysprocesses
where db_name(dbid) = @databaseName
and
DBID <> 0
and
spid <> @@spid
exec(@execSql)