Monday, January 31, 2011

SharePoint 2010 People Picker control

Introduction:
In this article we will discuss how we can use SharePoint 2010 People Picker control in a Visual Web Part.
Description:
There are two ways to add people picker control into a visual web part. Either you can programmatically add into the .cs file and finally add the control to a place holder like the below. You can also check this article on how to create a Visual Web Part in SharePoint 2010.

The below code will add a people picket control in to the page

Friday, January 28, 2011

How to save user profile properties programmatically in sharepoint 2010?

Introduction:
In this article we will discuss how to save user profile properties programmatically in SharePoint 2010 using SharePoint 2010 object model? You can also check my last article on get user profiles details programmatically in sharepoint 2010.
Description:
Here is the code to save user profile properties programmatically in SharePoint 2010.

string accountName = SPContext.Current.Web.CurrentUser.LoginName;
Logger.info("ProfileUserControl:btnSave_Click() Saving user profile properties.");

Default databases created after sharepoint 2010 installation

These are the databases that are created after sharepoint 2010 installation

Sharepoint 2010 social networking feature diagram

I found really a very beautiful high level digram while regarding the social networking features.

Here is the

Tuesday, January 25, 2011

Get user profiles details programmatically in SharePoint 2010

Introduction:
In this article we will discuss how to get user profile details by using SharePoint object model classes in SharePoint. In my last article we have discussed Save user profile properties programmatically in sharepoint 2010.
Description:
Here we will discuss how to get user profile properties and also how to access profile properties using SharePoint 2010. We have used here SharePoint object model.

The page can not be displayed error while opening a SharePoint site

In this post we will discuss about how to resolve The page can not be displayed error while opening a SharePoint site.

Also you can check out my previous posts on:

- New for visual webpart for SharePoint 2013 and Visual Studio 2012

- Check if list exists or not using TryGetList method in SharePoint 2010

- Add script reference dynamically through code in SharePoint

Few days back I got the error while opening my SharePoint site in my laptop on which I have installed SharePoint 2010. I have gone through a lot in google as well as I have posted a thread in the SharePoint forum. But I did not get a perfect answer for the problem. Finally I am able to solve the issue. Here are the steps:

Go to C:\Windows\System32\drivers\etc  location and there You will get a file name as HOST.

Open it in Notepad.

This file contains the mappings of IP addresses to host names. So here there must be a chance that this has been removed. So first give the IPAddres then <tab> then the Host name <tab> then <Enter> and then save the file. Hope this will work for you.

Example like below:

127.0.0.1  fewlines4biju 

HTTP Error 503. The service is unavailable in SharePoint

In this post we will discuss how we can resolve the issue which usually comes in SharePoint. The error message is: "HTTP Error 503. The service is unavailable in SharePoint".

Also you can check out my previous posts on:

- Difference between Apps and Solutions in SharePoint 2013

- Apply html to email template in SharePoint 2010 designer workflow

- New actions in SharePoint designer 2013 workflow: Call Web Service Action and Start workflow action

The full error message is: "HTTP Error 503. The service is unavailable in SharePoint".

Reason:
This error normally comes whenever a user changed the password for the account.

Solution:
To correct the error follow the below steps:

Go to Start -> All Programs -> Administrative Tools -> Internet Information Services (IIS) Manager.

Then Click on(+) the server name -> Application Pools then locate your application pools. Right click on the Application pool name go to Advance settings.

Go to process model then Identity Click on the Identity ->Set and then give the user name, password and confirm password.

This solution works for me, Hope this will also solve your problem.

How to use recurrance Pattern using redemption using c#.net?

Its really very diffcult to read all the occurrances of a recurring meeting using any of the APIs available in the market. Sometimes if you will read through outlook apis then it will not give the correct time if user send the meeting from different time zone. Hope the below way some how help you to read the recurrence item.

        RDOSessionClass session = new RDOSessionClass();
                session.Logon("", "", false, false, null, false);
                RDOFolder folder = session.GetDefaultFolder(rdoDefaultFolders.olFolderCalendar);
                RDOItems items = folder.Items;
   foreach (object item in items)
                {
                    if (item is RDOAppointmentItem)
                    {
  RDOAppointmentItem rdoItem = item as RDOAppointmentItem;
  RDORecurrencePattern recPatt = rdoItem.GetRecurrencePattern();

System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used

Error : System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used

Here is a problem that I have faced recently. I do not know exactly this is the proper solution or not. But ofcourse I am not facing the same problem after doing something in my code. And solution is to comment some lines of code. I have used System.Runtime.InteropServices.Marshal.ReleaseComObject(session); through out my application, that actually causes the error. I got a reference form the following articles

http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/13bf5c21-081b-4179-ba8c-2ff7e6a5a3da

http://social.msdn.microsoft.com/Forums/en/vsto/thread/5f24a42b-f23c-4d6d-8f11-b892da223500

And after that I have changed the code and it works for me. Hope this will too work for you if u will ever face any simillar problem.

Error System.Runtime.InteropServices.COMException (0x80040154)

I got an error while working with an outlook plugin application. The error messages is:

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {29AB7A12-B531-450E-8F7A-EA94C2F3C05F} failed due to the following error: 80040154.

And the solution for this is to register the redemption dll by using the command regsvr32 and then provide the location of the dll. For example

regsvr32 "D:\Redemption.dll"

Hope this will solve the problem.

Error System.InvalidCastException: Unable to cast COM object of type Microsoft.Office.Interop.Outlook.ApplicationClass

Here is a very critical error that comes while working with outlook APIs using C#.Net. The error details is :
System.InvalidCastException: Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).
   at Microsoft.Office.Interop.Outlook.ApplicationClass.get_Version()
   at ...

This error comes when we remove outlook 2007 from a XP machine and install 2003. Once we installed 2003 on that machine then the above error comes when I tried to add meeting. I have google a lot of things: some answers like ReInstall outlook again and another solution like remove something from the Registry. But I did not get any success by trying the above 2 solutions. Then I remove the outlook 2007 PAI from my system and then it worked for me.

How to add menus in outlook menu bar using c#.net object model

Here is the code to add menubar in outlook plugin application using c#.net object model.

private Office.CommandBar menuBar;
        private Office.CommandBarPopup newMenuBar;
        private Office.CommandBarButton buttonFeedback;

And in the ThisAddIn_Startup you can write the following lines of code that will show the menu  in the menu bar.

 menuBar = this.Application.ActiveExplorer().CommandBars.ActiveMenuBar;
    newMenuBar = (Office.CommandBarPopup)menuBar.Controls.Add(
                    Office.MsoControlType.msoControlPopup, missing,
                    missing, missing, true);

How to handle delete meeting in outlook plugin application development using c#.net?

Now a days I am working in a development team which develops outlook plugin application. We are developing the outlook pluggin application using c#.net, outlook APIs and also Redemption APIs. The application is all about saving the outlook meetings as well as outlook appointments (both normal and recurring meetings) and then handling the insert update delete functions performed by the users. And also we have the calling feature in which we are giving facilities to call by using Skype and office communicator.

We are saving all the meeting and appointment deatils in the XML in the local machine. we are uniquly defining the meeting by the globalappointmentid. There are 3 events in the outlook for add, update and delete like appointments_ItemAdd(object Item), appointments_ItemChange(object Item), appointments_ItemRemove().

How to read all outlook calendar items using c#.net using outlook APIs

Here is the sample code to read all the outlook calendar item using c#.net.
Namespace
using Outlook = Microsoft.Office.Interop.
Outlook;
using Office = Microsoft.Office.Core;
Code:
        Microsoft.Office.Interop.
Outlook.Application app = null;
        NameSpace ns = null;
        private static Outlook.MAPIFolder calendar = null;
        private Outlook.Items appointments = null;

The MVC Framework VS Classic ASP.NET

It is really a big question whether to use MVC framework or to use classic asp.net. But few point to remember:
The MVC Framework doesn't support classic postbacks and viewstate and doesn't consider any URL as the endpoint to a physical server file to parse and compile to a class. In ASP.NET, you have a 1:1 correspondence between a URL and a resource.
In the MVC Framework, a URL is seen as the mean to address a logical server resource, but not necessarily an ASPX file to parse.
Representational State Transfer, or REST:

REST is an architectural pattern that defines how network resources should be defined and addressed in order to gain shorter response times, clear separation of concerns between the front-end and back-end of a networked system. REST is based on three following principles:

    * An application expresses its state and implements its functionality by acting on logical resources
    * Each resource is addressed using a specific URL syntax
    * All addressable resources feature a contracted set of operations
The MVC Framework fulfills it entirely. But classic asp.net supports PostBack data model.

Web applications developed with ASP.NET MVC are even more SEO (Search Engine) friendly.

In case of MVC developer has to do more coding.

RDOItems GetActivitiesForTimeRange() function in outlook addin development

GetActivitiesForTimeRange is a method that returns calendar meeting items between the specified date range in C#.Net API. Here is a sample you can follow for reference.

RDOAppointmentItem mitem = null;
RDOSessionClass session = new RDOSessionClass();
               session.Logon("", "", false, false, null, false);
               RDOFolder2 folder = (RDOFolder2)session.

GetDefaultFolder( rdoDefaultFolders. olFolderCalendar);
               RDOItems items = folder.
GetActivitiesForTimeRange( StartDate.Date, StartDate.Date.AddDays(1), true);

How to encrypt a datatable and store in xml in c#.net?

Recently I am working with a project where I need to store the XML data in encrypted format. So I decided to encrypt the datatable and then save in xml file in C#.Net. Here are 2 functions that doing the encryption and decryption.

 /// <summary>
        /// This function will encrypt the datatable and write to xml into the filePath provided
        /// </summary>
       /// <param name="dataTable">DataTable to Write XML</param>
       /// <param name="filePath">Output FilePath</param>
        /// <returns>Returns Nothing</returns>
       public static  void EncryptFile(DataTable dataTable,string outPutFilePath)
       {
           XmlTextWriter Xtw = new XmlTextWriter(outPutFilePath, Encoding.UTF8);
           UnicodeEncoding aUE = new UnicodeEncoding();
           byte[] key = aUE.GetBytes("fewlines4biju");

Working with Singleton class

I have heard about singleton class but never use them. Reason may be we were not in need to do so. Here is the simple way to create a singleton class in C#.Net and use it.

Make a class with name Fewlines4Biju

Declare at class level
private static Fewlines4Biju fewlines4Biju;

Then make a method like:
 public static Fewlines4Biju  GetInstance()
        {
            if (fewlines4Biju == null)
            {
                fewlines4Biju = new Fewlines4Biju();
            }
            return fewlines4Biju;
        }

Fewlines4Biju fewlines4Biju = Fewlines4Biju.GetInstance();

 There are different methods available but I am trying this and it works fine for me. Hope this will work fine for you too.

DPI settings in Windows form in c#.net

If you are a windows form developer then you need to look at a lot of issues regarding the designing of the windows forms. Microsoft has handled these properties very carefully and also provides the required properties in the windows form properties. If you wiil change the system properties by (Right click on desktop->Properties Display Properties dialog will Open) then Settings->Advanced-> Then Change DPI settings to a different options (like Normal Size (96 dpi)/Large Size 120 dpi) then you display setting will change accordingly. So if you are making any Windows application then You need to set the Windows form properties accordingly. For this you need to:
Go to Windows form Properties then Select AllowScaleMode to DpiAutoSize=true. Then the form will behave accordingly.But remember if you are hardcode any thing like width and Height then it will not affect.
Hope this will work.
and

How to add menu in outlook using c#.net in plugin application?

For this you need to create c#.net outlook 2007 addin projects and here is a small brief by  which you can create outlook addin project.
From Visual Studio 2008 File -> New -> Project  From the New Project Dialog box Expand Visual C# then Office then Click on 2007 and the select Outlook 2007 Add-in from the Visual Studio installed templates. By doing this you will successfully able to create the Project. And in the addin project there will be a ThisAddIn.cs class. This class will be responsible for adding menus. Here is the code:

public partial class ThisAddIn
{
        private Office.CommandBarButton buttonHelp;
        private Office.CommandBarButton buttonFeedback;
        private Office.CommandBarButton buttonAbout;
        private string menuTag = "Fewlines4Biju";

    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
         //Search the menu and delete it if found
                    RemoveMenubar();
                    //Method to create new menu
                    AddMenuBar();
    }

How to get Current Outlook version installed and Current configured Email ID in C#.net?

Here is the code to retrieve the current outlook version installed like outlook 2003 or Outlook 2007 in C#.Net etc.

 public static string GetOutlookVersion()
       {
           Microsoft.Office.Interop.Outlook.Application applicationObject = new

Microsoft.Office.Interop.Outlook.Application();
           return applicationObject.Version;
       }

The following code gives you the current configured email id for outlook.There will be no issues whether it will be a POP3 account or it may be an exchange server account.

How to read Installed application path from the Registry in c#.net?

Suppose you have installed an application namely Fewlines4Biju and you want to read the installed path from the Registry. Then Here is the code that might be helpful.

RegistryKey regKey, regSubKey;
 regKey = Registry.CurrentUser;
 regKey = regKey.OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").OpenSubKey
("Office").OpenSubKey("Outlook").OpenSubKey("Addins").OpenSubKey("Fewlines4Biju");          
            string totalPath = regKey.GetValue("Manifest").ToString();
It will give the installed path.
 
 

How to trap calendar events in outlook meeting appointments in C#.Net?


Now a days I am working on a outlook plugin application where I am in need to catch up the events of the Calendar folder. I need to save the meeting details into our sql server database. I have followed http://adriandev.blogspot.com/2008/01/listening-to-calendar-events-with.html  link first to catch up the events But after that I am doing as the following and catching of the events. But exception case incase of delete events because in that case we can not able to catch the GlobalAppointmentID. So I am doing a differently. Still I am missing of something and you are wel come to give solutions for this.  Here is the code details Hope may be it will be helpful to you.
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
 public partial class ThisAddIn
{
        Microsoft.Office.Interop.Outlook.Application app = null;
        NameSpace ns = null;
        MAPIFolder calendar = null;
        Items appointments = null;
        private  Outlook.MAPIFolder DeletedItem;
        private  Outlook.Items itemDelete;

How to create a batch file in windows?

Here is the steps to create a batch file that will delete all the files from a specified folder.
Step 1:
Open Notepad
Step 2:
Copy the below code and paste it in the notepad.
cd\
cd C:\Program Files\Fewlines4biju\
del /Q *.*
echo Deleting Files
echo File Deleted
exit

Save the notepad with the extension as bat like fewlines4biju.bat
Step 3:
Run the batch file and it will delete all the files within the folder Fewlines4biju

For more information on batch file commands you can visit here.

How to split a string in CSharp.Net?

Here is the example to split a string with character separator using C#.Net.

string Date = "Feb/24/1981";
if (!string.IsNullOrEmpty(Date))
{
    char[] separator = new char[] { '/' };
    string[] s1 = Date.Split(separator);
    string Month = s1[0].ToString();
    string Day= s1[1].ToString();
    string Year= s1[2].ToString();
}

Here is the code to split a string from a string.
string strMain="my name is fewlines4biju and I have make my own website";string[] result = strMain.Split(new string[] { "fewlines4biju" }, StringSplitOptions.None);Then you can retrieve the value on the basis of the Array Index like result[0],result[1] etc.

How to read and write from a Text file in asp.net?

Here you will get a string array while reading all the lines and it will store one line to an array element in C#.Net.
And once you will get the array then you can modify what ever you want and then you can Write the whole array to the file.

Here is the code:
string[] Details = new string[0];
string strPath = @"C:\myfile.txt";
if (File.Exists(strPath))
            {
               
Details = File.ReadAllLines(strPath);
            }
//Here you will get in the form of array
           
Details [0] = "password^###~" + "What ever text you want";
Here you can write the whole array to the file.
            File.WriteAllLines(strPath,
Details );

Working with virtual directory in asp.net

Step to Create a virtual directory in asp.net web application:

Step 1:
 Right click on the project and Click on publish web site. Give there the Target Path and check the first 2 check boxes and Copy the Taget location.

Step 2:
 Then GO to Start -> Run ->inetmgr

It will open the Internet Information Services window.
Then expand your local directory and Right click on the web site then New -> Virtual directory. It will show the Virtual Directory wizard. Click Next.

How to get user defined table names?

Select 'Delete from '+name from sysobjects where xtype='u'

Friday, January 21, 2011

Unrecognized attribute 'allowInsecureTransport'. Note that attribute names are case-sensitive

In this post we will discuss about how to resolve error: Unrecognized attribute 'allowInsecureTransport'. Note that attribute names are case-sensitive.

Also you can check out my previous posts on:

- Create an event handler to prevent items from deleting item from SharePoint list using Visual Studio 2010

- Timeline web part in SharePoint 2013

- Delete Add new item link from list in SharePoint 2010

I got an error while adding the <spswc:statusnotescontrol runat="server" /> into a visual web part.The error is:

System.Configuration.ConfigurationErrorsException: Unrecognized attribute ‘allowInsecureTransport’. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\\client.config line )

Solution:

Download Windows6.1-KB976462-v2-x64 and install, it will solve you problem.

Location of microsoft.sharepoint.portal.dll in sharepoint 2010

While working in SharePoint 2010, I was in need to add reference to microsoft.sharepoint.portal.dll . When I go through the normal process, I did not get this dll inside the .net components. I got the dll in 2 places

1. C:\Windows\assembly
But the problem is I can not give reference from the GAC. Then I found the dlls in

2. C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAP :

Then here I was able to give reference.

Thursday, January 20, 2011

SharePoint List Vs Custom SQL Server database

A question always arise whether to store data in SharePoint list or in a database. There are actually some schenarious where it is better to use list and in some schenerious it is better to use database like:

Handles complex data relationships: In this schenirous Database will support but list will not.

Handles large numbers of items: To handle large numbers of items is possible in database but not in sql server.

Handles transactions: Handles transactions will be easier in database rather than in list.

How to use predicate in generics list of class type in c#.net

From these below lines you can check if a particular value is present in the list or not. And If exists you will get the index of the particular item in the list.

Here the list is lstMessages

if (lstMessages.Exists(delegate(Messages m) { return m.MessageID == Convert.ToInt64(dr["MessageID"]); }))
{

int index = lstMessages.FindIndex(delegate(Messages m) { return m.MessageID == Convert.ToInt64(dr["MessageID"]); });
}

This is the one way of using predicate in generics list class. You can also check some C#.Net articles here.

Wednesday, January 19, 2011

What are the default user permissions in windows sharepoint services

In this article we will discuss list of permissions available in Windows SharePoint Services:

  1. Read   This permission level gives read-only access to the Web site.
  2. Contribute   In addition to the Read permission level, the Contribute permission level allows you to create and edit items in existing lists and document libraries.
  3. Design   In addition to the Contribute permission level, the Design permission level allows you to create lists and document libraries, approve items, and edit pages in the Web site.
  4. Full Control   This permission level gives full control.
  5. Limited   The Limited permission level allows access to a shared resource within a site, such as a specific list, document library, folder, list item, or document, without giving access to the entire site.

How to debug a web part in SharePoint

Here is the steps to debug a web part in SharePoint :

Step 1:
open the project and set the appropriate breakpoints.
Step 2:
Create a Web Part Page on the default SharePoint site.
Step 3:
Add the Web Part to the page.
Step 4:
  • Attach the debugger to the W3wp process.
  • On the Debug menu in Visual Studio .NET,click Processes.
  • Verify that the Show system processes check box is selected.
  • Verify that the Show processes in all sessions check box is selected.
  • Under Available Processes, click W3wp.exe in the Process list, and then click Attach.
  • Under Choose the program types that you want to debug, select Common Language Runtime, and then click OK, Then Close
For more Refer: http://msdn.microsoft.com/en-us/library/dd583148(office.11).aspx

How to Create XML file in CSharp.Net

 public static String GetObjectXml<T>(T obj)
       {
           System.Xml.Serialization.XmlSerializer objxml = new System.Xml.Serialization.XmlSerializer(typeof(T));
           MemoryStream objStream = new MemoryStream();
           System.Xml.XmlTextWriter objWriter = new System.Xml.XmlTextWriter(objStream, Encoding.UTF8);
           objxml.Serialize(objWriter, obj);
           return new UTF8Encoding().GetString(((MemoryStream)objWriter.BaseStream).ToArray());
       }


Also you can do like:

           Here is the code to create xml.
            string strPath = @"C:\settings.xml";
            StringBuilder str = new StringBuilder();
            str.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?> ");           
            str.Append("<Settings>");
            str.Append("<Hello>");
            str.Append("123");
            str.Append("</
Hello>");

            str.Append("<Hai>");
            str.Append("234");
            str.Append("</
Hai>");         
            
            str.Append("</Settings>");           

            try
                {
                    FileStream file = new FileStream(strPath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                    StreamWriter sw = new StreamWriter(file);
                    sw.Write(str);
                    sw.Close();
                }
                catch(Exception ex)
                {
                }

Tutorials on WCF

Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows.
Uses System.ServiceModel.dll in the System.ServiceModel namespace.
Services:
The services can be local or remote, developed by multiple parties using any technology, versioned independently, and even execute on different timelines. Inside a service, you will find concepts such as languages, technologies, platforms, versions, and frameworks, yet between services, only prescribed communication patterns are allowed. The client of a service is merely the party consuming its functionality. The client can be literally anything—a Windows Forms class, an ASP.NET page, or another service.Clients and services interact by sending and receiving messages. Messages may transfer directly from client to service or via an intermediary. With WCF, all messages are SOAP messages. WCF services may communicate over a variety of transports, not just HTTP. WCF clients may interoperate with non-WCF services, and WCF services can interact with non-WCF clients. In WCF the client never directly interact with the services rather uses proxy to forward calls to the services.On the same machine the client can consume services in the same app domain,across machine boundaries the client can interact with services in its intranet or across the Internet.WCF provides the client with the same programming model regardless of the location of the service,whether the client is in local machine or in remote.
Address:
In WCF, every service is associated with a unique address. The address provides two important elements: the location of the service and the transport protocol or transport schema used to communicate with the service. The location portion of the address indicates the name of the target machine, site, or network; a communication port, pipe, or queue; and an optional specific path or URI.
WCF provides the following transport schemas like: HTTP,TCP,Peer Network,IPC(Inter Process Communicatiion),MSMQ.
And the address will always be like: http://localhost:8001
Ex. TCP address:
net.tcp://localhost:8002/MyWCFService (with ip address)
net.tcp://localhost/MyWCFService (without ip address)
Also same port can contain 2 services
like
net.tcp://localhost:800/MyWCFService
net.tcp://localhost:800/MyOtherService
Ex HTTP Address
http://localhost:8000 It also uses https for secure communications

How to use css in visual web part in sharepoint 2010

Introduction:
In this we will discuss how to use cascading style sheets (css) in visual web parts in SharePoint 2010.In my previous article I have explained in details:

- How to add custom web part properties to visual web part in SharePoint 2010?

- How to change date format in SharePoint 2010?

- Difference between Apps and Solutions in SharePoint 2013

Description:
To give style to a visual web part, a better approach is to use style sheet. To add a style sheet
First Right click on the project -> Add SharePoint Layouts mapped folder. Then visual studio 2010 automatically add the Layouts folder and all the contents will be deployed to the Layouts folder in the SharePoint root.

Within that folder sharepoint automatically create another folder with the name of the project. Within that folder you can add your css files.

How to call the css file?
To call the css file sharepoint provides CssRegistration control. Below is a sample code how to use that:

<sharepoint:cssregistration id="cssReg" name="/_layouts/ExpressionsWP/Style.css" runat="server"></sharepoint:cssregistration>

After that you can directly use the class name with the cssclass attribute. If you project name is Fewlines4WP the the css file will be deployed below:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\Fewlines4WP\Style.css

Tuesday, January 18, 2011

Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

In this post we will discuss how to resolve the below error:
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

Also you can check out my previous posts on:

- Share with everyone new feature in SharePoint 2013

- Show SharePoint list data in repeating table in infopath 2010 using SharePoint object model

- Display or Hide Quick Launch SharePoint 2010

I got through the below error while working in developing a custom web part in sharepoint 2010.

Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

I was using enterprise library for database communications.

Solution:
Go to the below directory (Hope you have default installation path, else you can change the path accordingly)
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG

Then open the wss_mediumtrust.config and wss_minimaltrust.config file. Be sure to take back up of both these files before modifying it.

Step:1
Copy the below line from wss_mediumtrust.config

SecurityClass
Name="SqlClientPermission"
Description="System.Data.SqlClient.SqlClientPermission, System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

And paste it in inside node of wss_minimaltrust.config

Step:2
Copy the below line from wss_mediumtrust.config file

ipermission class="SqlClientPermission" version="1" Unrestricted="true"

And Paste it in node of wss_minimaltrust.config

After that I think it will work. Please let me if it will impact ant sharepoint behaviour.

Monday, January 17, 2011

Difference between Intelligent and Hungry

These two words somehow change my life in a way. First of all how these two words come to my mind? Why I am thinking much about these two?

I do not know whether I am going to disclose official details or I am just sharing what I learn from a discussion. Any ways there is nothing in mind to go against the rules of the company, just want to share something. Last week I attended a meeting with my managers in my current organization. It’s around a 2hrs discussion. But I really felt the importance of the meeting after returning to my seat from the conference room.

There was a lot of discussion regarding focus, dedication towards work. But one thing that I was looking out for answer was “Whether I am hunger towards my work? Whether I really love the work, whether I had always in my mind about my work and responsibilities?”. I conclude that If someone is really hunger towards work not only in software field but also in any of the field then his intelligence will grow up. He definitely will start thinking in different manner, his process of work will change and that will reflect his eagerness towards work. Personally I realized and analyzed the whole day even after I came back from office. I really felt there were mistakes from my side and if I will try then I can rectify these issues.

I want to share one more thing: During the discussion I answered for a particular question, the answer is “Whenever I will get chance I hope I will succeed”. And the reply was very high level than my thought. He simply told me “Bijay there should not be like CHANCE, it should reflect on your way of work”. I feel that was extremely correct. If your work talks on behalf of you then definitely the chance will come to you. I will not say chance again but the opportunities will come to you. So let’s try to get the opportunities not the chance.

A sweet face that I never able to forget

It is really nice when some of the old beautiful memories come to mind. A long way back probably 13 years back, can not exactly remember the month name  but might be april or may. During my 10th exam I saw a face for around at max 10 days and till now i did not forget the face. Neither I was in love with her nor I have tried for the same. I did not know how her face come to my mind to at the time when I was in office. Might be bcoz this is not a working sat day thats why.

We were giving our 10th exam in a different centre. Our school was staying in a small school near by my exam centre. With us another school was also staying in the same school. There are 4 rooms and both school boys are staying in 2 rooms and girls are also staying in 2 consucative rooms. On the first day of my exam I saw a girl who was sitting behind me on the right handside. I was the 3rd topper of my school and the gap between the first topper and me was 200 marks difference. Ok forget the mark and all, I also feel shame for the difference of mark now. But I was capable enough to share some knowledge with others and that to in the examination centre too. I did not able to remember what was my first paper, but on the first day I saw the face of a beautiful, a gergeous girl. She was really gergeous. After the exam I did not able to see her but when I returned to my room I saw her in the same school. From the evening onwards whenever I got chance I visited near by there

My first experience as an Interviwer.

I will not say today is a very great day, but it is a different day for me. Today I have taken 3 interviews and all are face to face interviews in .net. Really I got different experience today. If I will describe about the candidates then one has 4 around another one has 3.5 around and the last one has around 3 yrs. And the last candidate is working as a Team leader in a small organization. But all are M not any F. Honestly I was nervoused while going to take the interview of the first candidate, but when I enter into the conference room and in the first 30 sec I came to knew that I can handle the candidate. I am a bit confident since the boy was not so gud in english as well as not good in technical too. I have taken around 25 min. But when the 2nd candidate came, I saw his resume, He has around 4 yrs of exp and he came from  the HCL. I asked him different questions from c#.net, asp.net and sql server. I asked him questions that I was asked while i was

Waiting for a perfect weekend.

I am really confused about how to spend the weekends, how can I spend so that I will not have any regreat, so that I can feel that as a perfect weekend. What should I do ?

The third sat day of each month is working, so except that i got sat day and sun day as off in every month. During my working days whenever I got something new work then I kept in mind to do that on the weekends, thats may be related to study or watching movie or even my web site work or anything else. But when  fri day evening comes from the office itself I was thinking thinking and thinking. First whether I should go a bit early since its fri day, then no I should work more since I can not work for next 2 days. Usually I came a bit late on that day specially in my current company. Once I came to my room then rather than planning to make the dinner I usually thought its a fri day night so lets go do something different rather daily work. So at that time I listen some music or some TV programmes or have a walk on the market.

My IT experience till now

I have been in the IT industry for more than 3.5 years. During this long period I have learnt a lot of things about the industry, the  kind of work, the team, the team members, the style of work, the company needs etc. This is totally my personal opinion, may be this is totally different for every one, I am just sharing my experience. You might have been a very good experience than me or may be a very bad experience. It depends.

Before I will tell you anything, Just remember one thing this is totally  a private sector and company is paying us, so we need to work. You can not say no to anything. And after somedays you became the expertise.

I am not really lucky enough to get a CMM level 5 company at the very begning still now not in that type of company. But I have no regreats since my current company is very good and I am enjoying my work here. On the other hand it feels very good that I have started my carrier from a company whose strength is within 10 (now strength is above 60). As a very small company you need to do all the things by alone, each and every part of a product or a web site. Any ways forget this...

Most funniest dream ever.

I am a very big fan of Sourav Ganguly from the very begining when I understand cricket. Honestly I could not able to remember when this dream cames but probably during my MCA period. As far as I am able to remember there was a match in Eden garden and Sourav Ganguly was the Captain of the Indian Cricket Team and due to some injurey He has to sit out from the match. Probably at that time I became fool by my self. After the dream I open my eyes and started smiling to myself and just hoping this might be true. And this is like: The Eden Garden was full of crowds, every one is just hoping to watch the batting pf Sourav Ganguly. But the sad news came at that time that Ganguly will not play in this match due to enjuiry and after that my role cames. Sourav Ganguly was discussing with  Me about the match and the playing eleven near the boundary line near the rope. And Ganguly was saying me to open the innings with Sachin tendulkar since he will not pla the match. And also he did not want to lose the match since this was his home ground. He was telling me like that I am the only dependant batsman in the Team. I was not giving importance to him since I was  in tense how to manage things. And suddenly I wake and found myself in the bed rather than the crowded stadium. Sad ...  Very Sad ... from Eden Garden to My Bed...

Another Oct 2nd for me

For every Indian Oct 2nd is rememberable for Gandhiji, I have too. But still I have something special. It someone's birth day... and she was very close to me, 2 years back... Be sure I now have only respect for her. I never tried to contact with her in the last 2 year, not even tried to call her. Nothing... I just let her live happily.

When I first came to gurgaon in 2006, I said her that on the next Oct I will be with you on ur next birth day. I was sure about that definitely i ll go to meet her in her next birth day. But time can change all the things and as time passes everything got changed, every promises and all.

I was really upset enough at that time since it was diffcult to forget someone who is very close to your heart, but now I reallly appriciate her decession  and hoping she is running with a very good life. And I know I even can not able to meet her on this year too since it is really tough to go now.

That I learn from my First Company

I am just sharing my personal experience of working in software development company.

I have started my carrier that consists of only single digit no of employees and i left the office when there are around 50 employees. And 1 interesting thing I was the last developer that my project manager did not take the interview, I was interviewed by my MD and CTO. I will never got any chance to interviewed by a MD and CTO. I got to know lots of things from there, make some very good friend, come across people whom I can never forget and come across people whom i will remember always. Got to know the difference between never forget and remember always. I got good responses,lots of warnings for my work and lots of things.

First thing that i learn "Never put your personal life and professional life at one place, then only you can enjoy both part, otherwise you will not feel the two beautiful parts. And i have done that sweet and small mistake in my life." Every one in the company knows that i always doing Orkut and Charting but at that time there was no issues because after all i was doing my work perfectly, But when i started mixing my personal life with professional life i started facing problem and you will get very few people who are with you during problems.

About Employees: