Friday, July 29, 2011

Authentication Providers disabled in SharePoint 2010

During my recent development I just came across this situation where I need to change Authentication Provider settings. I just found the option in disabled mode. Also other options like New, Extend, Delete where all disabled. I was in local administrator group as well.




My Server configuration is - Windows 2008 R2 Standard

I just closed browser and reopen with "Run As Administrator" and I found all options enabled.

The issue was with the User Account Control(UAC). You can enabled options from
UAC

What I did than was Just right click on the Internet Explorer.
IE -> Shortcut -> Advanced -> Check Run as administrator to always run IE as in administrator privileged.

Hope that help you.

Thanks,
Ashish Chotalia

Thursday, July 28, 2011

The specified user or domain group was not found - SharePoint 2010


SharePoint 2010, “The specified user or domain group was not found”

My Environment details:
SharePoint 2010 standalone installation on Windows 7.


You may face above error if you go to following locations from Central Administrator
Application Management -> Manage service Applications
Security -> Configure service accounts

You open SharePoint 2010 management shell and type following command.
Get-SpServiceApplication
Get-SpServiceApplication : The specified user or domain group was not found.
At line:1 chr:25 ...

You might have rename or deleted user account on your environment.


Open SQL server and go to your SharePoint_Configuration Database. Run below command.

    SELECT [Name], [Version], CAST([Properties] as xml)
    From [SharePoint_Config].[dbo].[Objects] with (nolock)
    Where [Name] LIKE ‘%Profile%’

click on xml2 data for 'User Profile Service Application' service name.

open xml data and search for 'm_SerializedAcl'. You will see users that are added. Just check whether that users exists or not on from your computer management screen. If not than you can create user from
Computer -> Manage -> Local Users and Groups -> users -> add user.


and than try to open above links.

I was able to open the link 'Manage service Applications' and 'Configure service accounts'. I had accidently renamed my existing user that's why it was showing such error.

Hope that's Useful.

Thanks,
Ashish

Tuesday, June 7, 2011

How to Get fully qualified assembly name


Hi,

    There are many times we need to have fully qualified name for assembly to give reference in .ascx or .aspx page, or when we want to add entries in config file(SafeControl section) to register signed dll.

    This utility will give you fully qualified url which you can use for the above scenarios.

    You can download Utility from here. Make sure you run exe with Administrator credentials.
 
Thanks,
Ashish Chotalia

Monday, February 21, 2011

An error has occurred on the server. http://go.microsoft.com/fwlink?LinkID=96177

Recently I was working on a class library using WSP builder, I stuck with following error once I execute command Copy to GAC.





All of my site stopped working and showing above message. I tried opening Central admin as well, it showed me below error.




I get back to my solution and open output window and I find below messages.

Cannot recycle SharePoint Central Administration v3
Installing Microsoft.Office.Server.dll into Global Assembly Cache.
Installing Microsoft.SharePoint.dll into Global Assembly Cache.
Installing Mydll.dll into Global Assembly Cache.

I just open GAC folder and see the version for above assemblies, which was having older version.
I got to know that WSPBuilder copies all dll files from debug/release folder. At the time of development I had taken this files(above dlls) on my local folder.
I just executed Copy to Gac command and it replaced older SharePoint dll it to GAC.

To overcome this issue I just go to 12 hive (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\)
and open ISAPI folder. I took "Microsoft.Office.Server.dll" and "Microsoft.SharePoint.dll" from here and copied it to GAC and it resolved my issue.

Hope this will help you to resolve your issue as well.

Thanks,
Ashish Chotalia

Tuesday, January 25, 2011

jQuery/Javascript to replace broken images

Many times you find your image links are broken. In firefox, Chrome if your images links are broken then your images are hidden by default. If you see same scenario in IE it will show you 'X' image missing.

I found following snippet quite useful which hides broken images using jquery.



$(document).ready(function(){ 
    $("img").each(function(index) {
        $(this).error(function() {
            $(this).unbind("error").attr("src", "/images/NoImage.png"); // If you want to replace with any blank image.

            $(this).hide();//You can simply Hide it using this.
        });
        $(this).attr("src", $(this).attr("src"));
  });    
});

Hope you find it useful.

Wednesday, January 5, 2011

Access Denied Error Message While Editing Properties of any Document in a MOSS Document Library

Recently after migrating site from one server to other server I face below issue.

You are having administrative access to SharePoint site and you are still getting access denied message. Here's window service code which will ask you for SharePoint site and List Name.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using Microsoft.SharePoint;

namespace ResetListFields
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("\r\n");
            Console.WriteLine(@"Please Enter WebUrl");
            string WebUrl = Console.ReadLine();
            Console.WriteLine("\r\nPlease Enter ListName");
            string ListName = Console.ReadLine();

            FixField(WebUrl, ListName);
            
        }
        static bool ListsExists(SPWeb CurrentWeb, string CurrentListName)
        {
            try
            {
                SPList List = CurrentWeb.Lists[CurrentListName];
                return true;
            }
            catch
            {
                return false;
            }
        }
        static void FixField(string WebUrl, string ListName)
        {

            string RenderXMLPattenAttribute = "RenderXMLUsingPattern";

            SPSite site;
            try
            {
                site = new SPSite(WebUrl);
            }
            catch (Exception)
            {
                Console.WriteLine("\r\nError while loading site URL. Program will terminate");
                Console.WriteLine("\r\nPress any key to continue...");
                Console.ReadLine();
                return;
            }
            using (SPWeb CurrentWeb = site.OpenWeb())
            {
                if (!ListsExists(CurrentWeb, ListName))
                {
                    Console.WriteLine("\r\nError while loading Custom list. Program will terminate");
                    Console.WriteLine("\r\nPress any key to continue...");
                    Console.ReadLine();
                    return;
                }
            }

            using (SPWeb CurrentWeb = site.OpenWeb())
            {
                SPList CurrentList = null;
                CurrentList = CurrentWeb.Lists[ListName];
                SPField f = CurrentList.Fields.GetFieldByInternalName("PermMask");

                string s = f.SchemaXml;

                Console.WriteLine("\r\nschemaXml before: " + s);

                XmlDocument xd = new XmlDocument();

                xd.LoadXml(s);

                XmlElement xe = xd.DocumentElement;

                if (xe.Attributes[RenderXMLPattenAttribute] == null)
                {

                    XmlAttribute attr = xd.CreateAttribute(RenderXMLPattenAttribute);

                    attr.Value = "TRUE";

                    xe.Attributes.Append(attr);

                }

                string strXml = xe.OuterXml;

                Console.WriteLine("\r\nschemaXml after: " + strXml);

                f.SchemaXml = strXml;
            }

            Console.WriteLine("\r\nPress any key to continue...");
            Console.ReadLine();
            return;

        }
    }
}

I found Anthony Odole post useful.

Hope you will find it useful.

Thanks,
Ashish Chotalia

Friday, December 24, 2010

How to copy assembly out of GAC?

You might Come across following situation while developing applications:
How to extract DLL from GAC?
How to take backup of dlls placed inside GAC?

Here's command that you can use to take backup of your GAC assemblies.

Create backup folder named 'AssemblyBack' where you want to place your backup files. I create folder at "C:\AssemblyBack"

Just navigate to the 'GAC_MSIL'
"C:\Windows\assembly\GAC_MSIL"

Once you are there just copy following command.
C:\Windows\assembly\GAC_MSIL>xcopy c:\AssemblyBack /s /y

Hope you find it useful.

Thanks,
Ashish Chotalia