SharePoint Search Server 2010 Error

I was experiencing the below error message. While searching the internet and poking around on my SharePoint farm for a possible solution to the error i was able to find the below solution.

Error: The mount operation for the gatherer application [GUID] -crawl-0 has failed because the schema version of the search gatherer database is less than the minimum backwards compatibility schema version supported for this gatherer application. The database might not have been upgraded.

Solution: Go to the Central Admin and determine the status of the SharePoint DB's. A healthy state shows "No Action Required" for all DB's but in my case the majority of my DB's needed to be updated.
Http://[central admin]/_admin/DatabaseStatus.aspx

Finally run this command: psconfig.exe -cmd upgrade -inplace b2b -wait

Upon completion of running this command everything read "No Action required" and I was able to run the SharePoint crawl once again.
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

How to assign an exiting SharePoint group to a site using the SharePoint object model?

The below code demonstrates how you can assign a SharePoint Group to a SharePoint site  using the SharePoint object model.

SPSite spsite = new SPSite("Site_Name");
try
{
     using (SPWeb web = spsite.OpenWeb())
     {
          web.AllowUnsafeUpdates = true;
          SPGroup sgrp = web.SiteGroups["Group_Name"];
          SPRoleDefinition roleDefinition = web.RoleDefinitions.GetByType(SPRoleType.Reader);
          SPRoleAssignment roleAssignment = new SPRoleAssignment((SPPrincipal)sgrp);
          roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
          web.RoleAssignments.Add(roleAssignment);
          web.Update();
     }
}
catch (Exception ex)
{
     LoggingManager.WriteEventToLogFile(ex);
}

 


 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

CAML Query Utility by U2U

This is a great utility which i have used countless times to generate CAML Queries.

Enjoy....

http://www.u2u.net/res/Tools/CamlQueryBuilder.aspx

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Anonymous Access

We had a issue with Anonymous Access  in our production environment. Each time a user would go to that list information there would be prompted to login. We followed the the step below to get around it...

List Permission Settings

1.     Stsadm -o deactivatefeature -url http://site.url.name -filename ViewFormPagesLockdown\feature.xml

2.     Break the inheritance for the list

3.     Uncheck the anonymous access for the list and save

4.     Reapply the anonymous access for the list and save

5.     Stsadm -o activatefeature -url http://site.url.name -filename ViewFormPagesLockdown\feature.xml

Useful link...

http://support.microsoft.com/kb/927082/en-us?spid=11373&sid=200

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Configurting BizTalk WS Adapter with ISAPI redirects work-around.

We recently encounted a problem trying to configure the BizTalk WS Adapters in our production environment and we were at a stand still until we ran into the below posted link that helped us rolling out our project to the production environment...

We received the below error message when we tried to configure the Windows sharepoint services adapter on a Load balanced Windows Server 2003 Environment.

"Error encoutered while querying virtual server state for URL: http//myserver/. Make sure the site is extended by Windows SharePoint Services. (CWssAdaCfg)"

THe below link provided a solution for us...

http://blogs.msdn.com/johnwpowell/archive/2008/08/14/error-configuring-biztalk-sharepoint-adapter-on-sharepoint-sp1.aspx

Thanks John Powell for the great post.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

InfoPath: Debugging and Setting up a App.config

The below article explains how to setup a your InfoPath environment for local debugging...

http://support.microsoft.com/kb/555963

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Ajax Enabled Webparts in MOSS: Work Arounds

Error Message:
Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

Solution:
Disabled the view state for control.
this.[ControlName].EnableViewState = false;

 


Error Message:
Script controls may not be registered before PreRender.

Solution:
Added a reference of Script Manager to the current Master Page.
     Add to the top of the Master Page: <%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" Namespace="System.Web.UI" TagPrefix="asp" %>

Added <asp:Scriptmanager/> right below the <WebPartPages/> in the master page.
     Look for in the Master Page: <WebPartPages:SPWebPartManager id="m" runat="Server"/>
     Add: <asp:ScriptManager ID="scriptManager1" runat="server"></asp:ScriptManager>


  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Reading Content From a SP List Web Service

The following code below enables you to read the response from MOSS List Web Service...

MOSSListWS.Lists list_svc = new MOSSListWS.Lists();

list_svc.Credentials = new System.Net.NetworkCredential(username,"password");

 

// The URL property for WebService retrieve

list_svc.Url = "http://ilocalhost/_vti_bin/lists.asmx";

XmlNode itemCollection = list_svc.GetListItems("listName", string.Empty, null, null, "0", null, "");

XmlDocument xmlDoc = new XmlDocument();

xmlDoc.LoadXml(itemCollection.OuterXml);

DataSet ds = new DataSet();

StringReader stringReader = new StringReader(xmlDoc.OuterXml);

ds.ReadXml(stringReader);

stringReader.Dispose();

dataGridView1.DataSource = ds.Tables[1];

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

SharePoint List WebService to Insert Item

Using the SharePoint List WebService to insert an item into a list...

WebService Reference: http://<servername>/_vti_bin/Lists.asmx

try
{
 ws_list.Lists list = new ws_list.Lists();
 list.Credentials = new System.Net.NetworkCredential("username", "password", "domain");
 XmlDocument doc = new XmlDocument();
 XmlElement batch_element = doc.CreateElement("Batch");
 string item = "<Method ID=\"1\" Cmd=\"New\">" + "<Field Name=\"ID\">New</Field>" + "<Field Name=\"Title\">This is a test</Field>" + "</Method>";
 batch_element.InnerXml = item;
 list.UpdateListItems("ListTest", batch_element);
}
catch(Exception ex)
{
string err = ex.Message;
}
 

Another Example

            try
            {

                /*Declare and initialize a variable for the Lists Web service.*/
                siteWebServiceLists.Lists listService = new siteWebServiceLists.Lists();

                /*Authenticate the current user by passing their default credentials to the Web service from the system credential cache.*/
                listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
                listService.Url = url + "/_vti_bin/Lists.asmx";
                System.Xml.XmlNode ndListView = listService.GetListAndView(list, "");
               
                /*Create an XmlDocument object and construct a Batch element and its attributes. Note that an empty ViewName parameter causes the method to use the default view. */
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                System.Xml.XmlElement batchElement = doc.CreateElement("Batch");
               
                batchElement.SetAttribute("OnError", "Continue");
                batchElement.SetAttribute("ListVersion", "1");
                batchElement.InnerXml = "<Method ID='1' Cmd='New'>" +
                "<Field Name='Title'>Title</Field>" +
                "<Field Name='First_x0020_Name'>Wayne</Field>" +
                "<Field Name='Last_x0020_Name'>Magnum</Field>" +
                "</Method>";

                /*Update list items. This example uses the list GUID, which is recommended, but the list display name will also work.*/
                System.Xml.XmlNode n = listService.UpdateListItems(list, batchElement);
                XmlTextReader xr = new XmlTextReader(n.OuterXml, XmlNodeType.Element, null);
                while (xr.Read())
                {
                    if (xr.ReadToFollowing("z:row"))
                    {
                        if (xr["ows_ID"] != null)
                        {
                            Console.WriteLine(xr["ows_ID"].ToString());
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Custom Collection Parameter in a Web Service

This post below will show you how to pass a custom collection as a parameter to the webservice.
Create a custom collection class...
public class Person
{
public int Age;
public string FName, LName;
public Person() { }
 
public Person(string fname, string lname, int age)
{
Age = age;
FName = fname;
LName = lname;
}
}
 
Create a Web Method...
 
[WebMethod]
public void Method(Person[] fields, bool attachmentincluded)
{
           System.Collections.Generic.List<Person> people = new List<Person>(fields);
            foreach (Person i in people)
            {
                string F, L;
                int A;
                F =i.FName;
                L = i.LName;
                A = i.Age;
            }
 }
 
In the consumer application...
 
     //Create People...
     localhost.Person john = new localhost.Person();
     john.FName = "John";
     john.LName = "Doe";
     john.Age = 37;
    
     localhost.Person jane = new localhost.Person();
     jane.FName = "Jane";
     jane.LName = "Doe";
     jane.Age = 37;
    
     //Create array
     localhost.Person[] people = { john, jane };
 
     //Call Web Service
     localhost.Service1 s = new localhost.Service1();
     s.Method(people, false);
 

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati