About Me

My photo
a Dynamic and Energetic guy.....

Wednesday, December 31, 2008

Change the user data in "CCF session control"

Add the following code inside the button_Click event in the hosted windows application

Context objContext = new Context();
objContext.SetContext(this.Context.GetContext());

// CustomerFirstName is the property name that use to identify customers' first name

objContext["CustomerFirstName"] = "Now my name is chanaka";
ContextEventArgs contextEventArgs = new ContextEventArgs(objContext);
this.FireChangeContext(contextEventArgs);
this.NotifyContextChange(objContext);

Wednesday, December 10, 2008

CCF Tips

Problem--> "Configuration has encountered a problem while trying to access the Configuration web service. The HTTP request is unauthorized with client authentication scheme"

Reason --> The user doesn't have enough permissions to access the inbuilt websites

Solution --> (1) Go to the 'C:\Inetpub\wwwroot'
(2) Open the web.config file of each website
(3) Change the access write to authorized users

=============================================================================================

Problem--> "C:\Program Files\Support Tools> httpcfg set urlacl /u http://+:1000/ /a D:(A;;GX;;;s-1-5-21-3811445897-853718750-2640504884-1107) returns 1332 other than 0"

Reason --> The Operating system is not 32 bit

Solution --> (1)Go to http://www.microsoft.com/downloads/details.aspx?FamilyID=96A35011-FD83-419D-939B-9A772EA2DF90&displaylang=en
(2) install this if you are using 64bit Server version


=============================================================================================

Monday, December 8, 2008

What is Customer Care Framework


Customer Care Framework is well known as CCF. This is not a really new technology. But now this is coming with new features with release of CCF 3.0. The CCF is consists of many components like Admin Console, Adapter Manager, Web Services + Multi Channel Services. All these are integrated with Agent Desktop. This helps agents to work in a efficient manner with less stress. The integration capability is expanded to Sharepoint, Biztalk & all other business applications.

Wednesday, November 26, 2008

Deploy .Cab Solution Webpart into sharepoint

(1) Open the command prompt
(2) Change the path to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin
(3) run the stsadm command to deploy the cab file
stsadm -o addwppack -globalinstall -force -filename C:\SearchWebPart_CSharp.cab

(4) Go to sharepoint site's webpart gallery
(5) Go --> New and populate the webpart
(6) Add the webpart into your page :)

Monday, November 24, 2008

Sending an Email Using .NET

private void sendingEmail(string pstrSendingEmails)
{
try
{
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
System.Net.NetworkCredential cred = new System.Net.NetworkCredential("irononechanaka@gmail.com", "password1");

string strEmails = "sahanganepola@yahoo.com";
mail.To.Add(strEmails);

mail.Subject = "Email from workflow ";
mail.From = new System.Net.Mail.MailAddress(strEmails);
mail.IsBodyHtml = true;
mail.Body = "hi dear friend";

System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com");
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = true;
smtp.Credentials = cred;
smtp.Port = 587;
smtp.Send(mail);
}
catch (Exception ex)
{

}
}

Friday, October 31, 2008

WORKFLOW FOUNDATION ENGINE

It's time to move from sharepoint to workflow engine. Actually i have to combine these 2 technologies.

WORKFLOW FOUNDATION (WF) has 2 main areas
(1) WCF(Windows Communication Foundation)
(2) WPF(Windows Presentation Foundation)

when design the workflow it has 3 approaches
(1) No-Code (using Sharepoint Designer)
(2) Code (Using VS++++++)
(3) Code-beside (combination of above methods)

The WF came up with many advanced concepts like,
***Validator
***Executor
***Serializer

So many will come soon... :)

Programatically Add a WORKFLOW to a SPList

private void setWorkflow()
{
try
{
SPWeb web = site.RootWeb;
SPList refList = web.Lists["DepartmentDetails"];

SPWorkflowManager wfManager = site.WorkflowManager;
SPWorkflowTemplateCollection wfTemplates = wfManager.GetWorkflowTemplatesByCategory(web, null);
string test = wfTemplates[0].Name;
test = wfTemplates[1].Name;
test = wfTemplates[2].Name;
test = wfTemplates[3].Name;
test = wfTemplates[4].Name;
SPList taskList = web.Lists["Tasks"];

Guid WorkflowHistoryGuid = web.Lists.Add("HistoryOfWorkflow", "description History", SPListTemplateType.WorkflowHistory);
SPList HistoryList = web.Lists[WorkflowHistoryGuid];
//SPList HistoryList = web.Lists["HistoryOfWorkflow"];

SPWorkflowTemplate wfTempl = wfTemplates.GetTemplateByName("Approval", CultureInfo.CurrentCulture);
SPWorkflowAssociation wfAssocite = SPWorkflowAssociation.CreateListAssociation(wfTempl, wfTempl.Name, taskList, HistoryList);

wfAssocite.AutoStartCreate = true;
refList.AddWorkflowAssociation(wfAssocite);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

Wednesday, October 29, 2008

Working With SPList & CAML Queries

SPWeb web = site.RootWeb;
SPList refList = web.Lists["refLstAAProgress"];
SPQuery
query = new SPQuery();


//
WITH MORE RESCRICTIONS

query.Query= "<Where><And><Eq><FieldRefName='colFormName' /><Value Type='Text'>" + pFormName +"</Value></Eq><Eq><FieldRef Name='colGroup'/><Value Type='Text'>"+ pGroupName+"</Value></Eq></And></Where>";


//
SIMPLE FILTERING

//query.Query= "<Where><Eq><FieldRef Name='SystemName'/><ValueType='Text'>" + pstrSystemName + "</Value></Eq></Where>";


SPListItemCollection collec = refList.GetItems(query);

//
UPDATE AN ENTRY

if (collec!= null && collec.Count > 0)


{

SPListItem itemEdit = collec[0];

itemEdit["colIsDone"]= "True";

web.AllowUnsafeUpdates= true;

itemEdit.SystemUpdate();

}


web.AllowUnsafeUpdates= false;

web.Dispose();

//ADD AN ITEM TO THE LIST


SPWeb web = site.RootWeb;

web.AllowUnsafeUpdates = false;
SPList
refList = web.Lists["refLstStageTracking"];
SPListItem
newListItem =logginList.Items.Add();
newListItem["Title"] ="GOGOGO";
newListItem["colFormName"] =pFromName;
newListItem["colStage"] = pStage;

newListItem["colLoginName"] = pLoginName;

newListItem.Update();

Thursday, October 23, 2008

Enable Search In Sharepoint Easily

1) Go to CURRENT Web application through Central Administration

2) Create a site collection using "SEARCH CENTRE WITH TABS" under ENTERPRISE tab

3) Name as "SearchSiteChanaka"

3) Go to the CURRENT site

4) Go to all site settings

5) Search settings --> set as /sites/SearchSiteChanaka/Pages/

6) When user click he will be redirected to the search result page J

One small thing that you have to do now...

Go to

7) SSP

8) then go to 'Search settings'

9) Click on 'Content sources and crawl schedules'

10)Set incremental or full crawl

Now that's all

:)

Friday, October 17, 2008

MySite Creation Programatically

ServerContext context = ServerContext.GetContext(site);

UserProfileManager profileManager = new UserProfileManager(context);

foreach(UserProfile userProfile in
profileManager)

{try
{
string userName =userProfile[PropertyConstants.AccountName].Value.ToString();

Logger.LogDebug("Creating
personal site for user : "
+ userName);

userProfile.CreatePersonalSite();
Logger
.LogDebug("Created
personal site for user : "
+ userName);

SPSite personalSite = userProfile.PersonalSite;

using(SPWeb web = personalSite.OpenWeb())
{

if
(!Utility.ListExists(ConfigurationInfo.PhotoLibraryDisplayName,web))
{
SPListTemplateType templateType = SPListTemplateType.PictureLibrary;
Guid
listId = web.Lists.Add(ConfigurationInfo.PhotoLibraryDisplayName,null, templateType);

SPList PhotoLibrary = web.Lists[listId];
PhotoLibrary.Description = "This is a picture library to show photos";

PhotoLibrary.Title= ConfigurationInfo.PhotoLibraryDisplayName;
PhotoLibrary.OnQuickLaunch= true;
PhotoLibrary.Update();

web.AllowUnsafeUpdates = true;
web.Dispose();

}

}

}


catch(Exception ex)

{
Logger
.LogDebug("error while creating MySite :" + ex.Message);
}
}

My Masters