Thursday, April 5, 2012

System.ServiceModel.EndpointNotFoundException

The following error occurred on my development machine in every 5 minutes in OWSTimerJob.exe
To fix this issue, need to start Forefront end service from services management window

Sunday, March 4, 2012

Fixing issue Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

Following issue has occurred at the time of BCS configuration.
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
 To fix this issue use the following steps:

Next run the following shell script with admin previllege:
 
$bdc = Get-SPServiceApplication | where {$_ -match “Business Data Connectivity”};
$bdc.RevertToSelfAllowed = $true;
$bdc.Update();
 




Ref: http://niranjanrao.wordpress.com/2012/01/12/bcs-authentication-issues-login-failed-for-user-nt-authorityanonymous-logon-or-access-denied-by-bcs/

Sunday, January 22, 2012

Windows Server 2008: Allow multiple sessions

To allow  multiple session for a user please perform following steps:

1. Type gpedit.msc in Run and click Connection from the window.
2. Now select Restrict Remote Desktop Services users to a single Remote Desktop :
3. A window will be open , Select disable from this window.  

SharePoint 2010 Cumulative Updates

After Installing SharePoint 2010, It is time to install the updates. Following are the steps:



1)      Download and install SharePoint Foundation SP1


2)      Download and install SharePoint Server SP1


3)      Download the latest Cumulative Update (CU), that is December 2011.


4)      Install the December 2011 CU on the server.

5)      You may found ‘Forefront Identity Synchronous Service’ is stopped. Do not panic, perform the following steps

6)      On the ‘Central Admin’ -> Manage Services on server’ -> Stop and Start User Profile service

7)      Stop and Start User Profile Synchronous Service

8)      Run the following command using ‘Run as Administrator’

psconfig -cmd upgrade -inplace b2b -wait –force
9)      IIS Reset

Tuesday, December 6, 2011

Error: Your current security settings prohibit running activeX on this page

While designing a InfoPath form on Windows Server 2008 R2, received the following error message. "Your current security settings prohibit running activeX on this page". This issue was occurred when I drag a 'Contact Selector' at the time of designing a form.

First, I thought to minimize the IE security permission level. But that action was not helped at all. Then I found this blog to disable Internet Explorer Enhanced Security Configuration.
 The final output: the 'Contact Select' is working fine.

Wednesday, November 9, 2011

Silverlight webpart in SharePoint 2010

Foolowing are the steps for creating a silver light webpart for SharePoint 2010.

1) Create a new project with the template "Silverlight Application"
2) Un-check "Host the Silverlight application in a new web site.
3)  Add the following references from this path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin".
Microsoft.SharePoint.Client.Silverlight.dll
Microsoft.SharePoint.Client.Silverlight.Runtime.dll

4) Add this reference as well System.Windows.Controls.Data.Input
5) After adding the reference, the solution pane should look like this:

6) Next step is to design the XAML:
< UserControl x:Class="SilverlightApplicationHelloWorld.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:datainput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" >
    < Grid x:Name="LayoutRoot" Background="White">
        < Button Click="btnLoadSite_Click" Content="Load Site" Height="23" HorizontalAlignment="Left" Margin="25,12,0,0" Name="btnLoadSite" VerticalAlignment="Top" Width="75" >< /Button >
        < Canvas Name="canvasLabels" Visibility="Collapsed" >         
            < datainput:Label Content="Site: " Height="22" HorizontalAlignment="Left" Margin="41,55,0,0" Name="label1" VerticalAlignment="Top" Width="73" >< /datainput:Label >
            < datainput:Label Height="22" HorizontalAlignment="Left" Margin="120,55,0,0" Name="label2" VerticalAlignment="Top" Width="233" >< /datainput:Label >
            < datainput:Label Content="Url:" Height="24" HorizontalAlignment="Left" Margin="41,84,0,0" Name="label3" VerticalAlignment="Top" Width="73" >< /datainput:Label >
            < datainput:Label Height="24" HorizontalAlignment="Left" Margin="120,84,0,0" Name="label4" VerticalAlignment="Top" Width="233" >< /datainput:Label >
            < datainput:Label Content="Description" Height="26" HorizontalAlignment="Left" Margin="41,116,0,0" Name="label5" VerticalAlignment="Top" Width="73" >< /datainput:Label >
            < datainput:Label Height="26" HorizontalAlignment="Left" Margin="120,116,0,0" Name="label6" VerticalAlignment="Top" Width="233" >
             < /datainput:Label >
        < /Canvas >
    < /Grid >
< /UserControl >

7) Add the following in code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.SharePoint.Client;
namespace SilverlightApplicationHelloWorld
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
        private ClientContext context = null;
        private Web web = null;
        private delegate void UpdateUIMethod();
        private void btnLoadSite_Click(object sender, RoutedEventArgs e)
        {
            context = ClientContext.Current;
            web = context.Web;
            context.Load(web, w => w.Title, w => w.Description, w => w.ServerRelativeUrl);
            context.ExecuteQueryAsync(OnSiteLoadSuccess, OnSiteLoadFailure);
        }
        private void OnSiteLoadSuccess(object sender, ClientRequestSucceededEventArgs e)
        {
            UpdateUIMethod updateUI = LoadSiteData;
            this.Dispatcher.BeginInvoke(updateUI);
        }
        private void OnSiteLoadFailure(object sender, ClientRequestFailedEventArgs e)
        {
            MessageBox.Show("Request Failed: " + e.Message + ", Stack Trace:" + e.StackTrace);
        }
        private void LoadSiteData()
        {
            canvasLabels.Visibility = System.Windows.Visibility.Visible;
            label2.Content = web.Title;
            label4.Content = web.ServerRelativeUrl;
            label6.Content = web.Description;
        }
    }
}
8) For deployment there are two steps:
8a) Directly deploy to "Client Bin" folder.
Change the "Output Path" to "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin" in the Solution -> Property page.
Now, add a Silverlight webpart on a sharepoint page and set the URL as
"_layouts/ClientBin/SilverlightApplicationHelloWorld.xap". 
 
8b) Other approach is add the XAP to a document libratry, and give the path in Silverlight webpart

Wednesday, November 2, 2011

Accessing Lists.asmx

I Got a requirement to access a list data through web service. Therefore, I consumed 'Lists.asmx' built-in service provided by SharePoint.


1) Following codes are required to get list item through CAML query

            Lists listService = new Lists();
            listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
            listService.Url = "http://spsserver" + "/_vti_bin/lists.asmx";
            XmlDocument xmlDoc = new System.Xml.XmlDocument();
            XmlNode ndQuery = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "");
            XmlNode ndViewFields =
                    xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields", "");
            XmlNode ndQueryOptions =
                    xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");


            ndViewFields.InnerXml = "";
            ndQuery.InnerXml = "" +
                                "0";
            try
            {
                XmlNode ndListItems = listService.GetListItems("Tasks", null, ndQuery, ndViewFields,null, null, null);
                foreach (System.Xml.XmlNode listItem in ndListItems.ChildNodes[1].ChildNodes)
                {
                    if (listItem.OuterXml.Contains("ows_Title"))
                    {
                        txtValue.Text += Environment.NewLine + listItem.SelectSingleNode("@ows_Title").Value.Trim();
                        string strStartDate= listItem.SelectSingleNode("@ows_StartDate").Value.Trim();
                        DateTime dtConvert = DateTime.SpecifyKind(DateTime.Parse(strStartDate), DateTimeKind.Utc);
                        txtValue.Text += "  " + dtConvert.ToLocalTime().ToString();
                    }
                }
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                MessageBox.Show("Message:\n" + ex.Message + "\nDetail:\n" +
                    ex.Detail.InnerText +"\nStackTrace:\n" + ex.StackTrace);
            }
2) This code is for updating a list item through batch update
            try

            {
                string strBatch = " 2" +
                                       "a test data";
                XmlDocument xmlDoc1 = new System.Xml.XmlDocument();
                System.Xml.XmlElement elBatch = xmlDoc1.CreateElement("Batch");
                elBatch.SetAttribute("OnError", "Continue");
                elBatch.SetAttribute("ListVersion", "1");
                elBatch.InnerXml = strBatch;
                XmlNode ndReturn = listService.UpdateListItems("Tasks", elBatch);
                MessageBox.Show(ndReturn.OuterXml);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }