22 December 2009

Implementing Color Events in SharePoint Calendar

Hi,

I have color coded event implemented in SharePoint calendar using simple steps and without coding.
All I have done is created a calculated field with input color segment column and a script to include this selected color.

1. Create a Choice type Field named Color .




2. Add the needed colors
3. Create a calculated field name Calendar text Insert formula :

=Color&"|||"&Title

4. Add a CEWP(Content Editor WebPart)

<script language="JavaScript">


var SEPARATOR = "|||";
var nodes, category;
nodes = document.getElementsByTagName("a");

for(var i = 0; i < nodes.length; i++)
{
if(nodes[i].innerText.indexOf(SEPARATOR) != -1)
{
UpdateCalendarEntryText(nodes[i]);
var foundNode = nodes[i];
var trap = 0;
while(foundNode.nodeName.toLowerCase() != "td") {
foundNode = foundNode.parentNode;
trap++;
if(trap > 10)
{
break; // don't want to end up in a loop

}
}

var colour = GetCalendarColour(category);

if(colour ! "")
foundNode.style.background = colour;
}
}

function UpdateCalendarEntryText(anchorNode)
{
var children = anchorNode.childNodes;
for(var i = 0; i < children.length; i++)

{

if(children[i].nodeType == 3 && children[i].nodeValue.indexOf(SEPARATOR)
!= -1)
{
var parts = children[i].nodeValue.split(SEPARATOR);
category = parts[0];
children[i].nodeValue = parts[1];
}
else
UpdateCalendarEntryText(children[i]);
}
}

function GetCalendarColour(desc)
{
var colour;

switch(desc.toLowerCase())
{

case "red":
colour = "#ff0000";
break;


case "blue":
colour = "#0000ff";
break;


case "yellow":
colour = "#ffff00";
break;


case "green":
colour = "#008000";
break;

case "orange":
colour = "#ff8040";
break;

default:
colour = "";

}
nbsp;
return colour;
}

</script>


Bingo



--------

23 October 2009

Simple SharePoint Code Snippets

Here are few code snippets that are handy to use while creating a WebParts.

Added / Updating SharePoint List
osite =SPContext.Current.Site;
oweb = osite.OpenWeb();

oweb.AllowUnsafeUpdates = true;

SPList olist = oweb.Lists["LIST NAME"];

SPListItem newTask = olist.Items.Add();

newTask["Title"] = TextBox1.Text.ToString();

newTask["Comments"] = txtComments.Text.ToString();
newTask.Update();
lbstatus.Text = "Comments Added successfully";
txtComments.Text = "";

lbstatus.Visible = true;

oweb.AllowUnsafeUpdates = false;
oweb.Close();






24 September 2009

KPI : custom Code WebPart



Here i'v developed a webpart for showing KPI indicators which are binded as desired
i have used a literal control and binded a my display structure in this literal control.

Code
//inialization
private LiteralControl Literal1;
SPSiteoCurrentSite = null;
SPWeb oweb =null;
int count;
DataTable dt =new DataTable();
string strStruct;

In CreateChildControls()
Literal1 = new LiteralControl();
Literal1.Load += new EventHandler(Literal1_Load);
Controls.Add(Literal1);
-------
on load event of Literal Control i'll be calling my Core functionlity which will be binded with this literal control.

MyFunction()
{
try {
count = 0;
//oCurrentSite = new
SPSite("http://syngdcds0138:1111");

oCurrentSite = SPContext.Current.Site;
oweb = oCurrentSite.OpenWeb();
oweb.AllowUnsafeUpdates = true;
SPList oProjectName = oweb.Lists["Tasks"];
SPQuery Query1;
DataTable Dtable;
DataView Dview;
SPListItemCollection items1;
SPUser currentUser = oweb.CurrentUser;
string UNAme = currentUser.Name;
Query1 = new SPQuery();
Dtable = new DataTable();
Dview = new DataView();
Query1.Query = "<Where><Eq><FieldRef Name='AssignedTo' /><Value Type='User'>" +
currentUser.Name + "</Value></Eq></Where>";
items1 = oProjectName.GetItems(Query1);
strStruct = "<div>" + "<table>";
foreach (SPListItem objItem in items1)
{//Pending Completed Overdue
string picture = string.Empty;
if (objItem["Status"].ToString() == "Overdue")
{ picture = @"~/_LAYOUTS/Images/ico-task-overdue.jpg";
}
else if (objItem["Status"].ToString() == "Completed")
{ picture = @"~/_LAYOUTS/Images/ico-task-Completed.jpg";
}
else
{picture = @"~/_LAYOUTS/Images/ico-task-Pending.jpg";
}
string[] CreatedBy = objItem["Created By"].ToString().Split('#');
string AssignedBY = CreatedBy[1];
string DDt = Convert.ToDateTime(objItem["DueDate"].ToString()).ToShortDateString();
strStruct += "<tr>" + "<td colspan=2 align='left'>" + "<img src='" + ResolveUrl(picture) +
"'
/>&nbsp;&nbsp;&nbsp;"
+ "<a style='text-align:right; font-size:12px;' href='" + oweb.Url +
"/Lists/" + oProjectName.Title + "/DispForm.aspx?ID=" + objItem["ID"].ToString() + "&Source=" + oweb.Url + "'>" + objItem["Title"].ToString() + "</a>" + "</td></tr>" + "<tr><td colspan=2 style= 'font-family:Arial; font-size:xx-small;'>Due Date:" + DDt + "&nbsp;&nbsp;Assigned By:"
+ AssignedBY + " </td></tr>";
}
strStruct += "<tr><td></td><td> <a href='" + oweb.Url + "/Lists/" + oProjectName.Title + "/Allitems.aspx'>More&gt;&gt</a>" + "</td></tr>" + "<tr>" +
"<td><img
src='~/_LAYOUTS/images/ico-task-Completed.jpg'> Completed "
+
"<img
src='~/_LAYOUTS/images/ico-task-Pending.jpg'> Pending "
+
"<img
src='~/_LAYOUTS/images/ico-task-overdue.jpg'> Overdue </td>"

+ "</tr>" + "</table></div>";
Literal1.Text = strStruct;
}
catch (Exception ee) { //Error}
}

Revert your comments for this article

22 September 2009

Meeting WorkSpace Webpart :- Gets All Meeting Task

This WebPart is developed get all the Task which are added in a Decision Meeting Workspace template selected. since SharePoint does not provide any out-Of-Box functionality to segregate this vital information.
hence a custom WebPart was developed by my associate.
Initially all the related reference /namespaces are added , despite of Microsoft.sharepoint;
We also be needing :
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.Meetings;
//Core Code for WebPart.
public class MeetingWorkspace : System.Web.UI.WebControls.WebParts.WebPart
{

//Initilization
SPGridView m_grid;
SPWeb web1 = SPContext.Current.Web;
ObjectDataSource objDataSource = new ObjectDataSource();
//Override Methods
protected override void CreateChildControls()
{
try
{
Type type = this.GetType();
objDataSource.ID =
"mTaskDS";
objDataSource.TypeName = type.AssemblyQualifiedName;
objDataSource.SelectMethod =
"GetListItems";
objDataSource.ObjectCreating +=
new ObjectDataSourceObjectEventHandler(objDataSource_ObjectCreating);
this.Controls.Add(objDataSource);
#region SPGridView Details
m_grid =
new SPGridView();
m_grid.AutoGenerateColumns =
false;
m_grid.Columns.Clear();
HyperLinkField meetingName = new HyperLinkField();
meetingName.HeaderText =
"Meeting Name";
meetingName.DataTextField =
"MeetingName";
string[] strmeetingName = { "MeetingSiteUrl" };
meetingName.DataNavigateUrlFields = strmeetingName;
meetingName.DataNavigateUrlFormatString =
"{0}";
m_grid.Columns.Add(meetingName);

BoundField t = new BoundField();
t.DataField =
"Title";
t.HeaderText =
"Task Title";
m_grid.Columns.Add(t);
BoundField b = new BoundField();
b.DataField =
"Status";
b.HeaderText =
"Status";
b.HtmlEncode =
false;
b.SortExpression =
"Status";
m_grid.Columns.Add(b);
BoundField colStartDate = new
BoundField();
colStartDate.DataField =
"StartDate";
colStartDate.HeaderText =
"Start Date";
colStartDate.HtmlEncode =
false;
m_grid.Columns.Add(colStartDate);
BoundField colDueDate = new
BoundField();
colDueDate.DataField =
"DueDate";
colDueDate.HeaderText =
"Due Date";
colDueDate.HtmlEncode =
false;
m_grid.Columns.Add(colDueDate);
m_grid.DataSourceID =
"mTaskDS";
m_grid.AllowGrouping =
true;
m_grid.AllowGroupCollapse =
true;
m_grid.GroupField =
"MeetingName";
m_grid.GroupFieldDisplayName =
"MeetingName";
m_grid.AllowSorting =
true;
m_grid.AllowPaging =
true;
Controls.Add(m_grid);
m_grid.DataBind();
m_grid.PageSize = 3;
m_grid.PageIndexChanging +=
new GridViewPageEventHandler(m_grid_PageIndexChanging);
m_grid.PagerTemplate =
null;
#endregion

base.CreateChildControls();
}
catch(Exception ex) { //Error }
}

//Data View Method
public DataView GetListItems()
{
DataView dv = new DataView();
DataTable dt = new DataTable();
try
{
string rowFilter = "AssignedTo = '" + SPContext.Current.Web.CurrentUser.Name + "'";
foreach (SPWeb web in web1.Webs)
{
if (SPMeeting.IsMeetingWorkspaceWeb(web))
{
SPMeeting meeting = SPMeeting.GetMeetingInformation(web);
// A Meeting Workspace has a Meeting Series list with information about all meetings in the workspace.
SPList meetings = web.Lists["Meeting Series"];
// Get the meeting items that fit the criteria.
SPListItemCollection items = meetings.Items;
// Now extract useful information about each meeting.
foreach (SPListItem item in items)
{
int instanceID = (int)item["InstanceID"];
SPQuery query =new SPQuery();
query.MeetingInstanceId = instanceID;
query.Query = @"<Query> <Where><IsNotNull> <FieldRefName='ID' /> </IsNotNull></Where></Query>" ;
SPList list = web.Lists["Tasks"];
DataTable dtMItems = list.GetItems(query).GetDataTable();
if (dtMItems.Columns["MeetingName"] == null)
{
dtMItems.Columns.Add("MeetingName");
dtMItems.AcceptChanges();
}
if (dtMItems.Columns["MeetingSiteUrl"] == null)
{
dtMItems.Columns.Add("MeetingSiteUrl");
dtMItems.AcceptChanges();
}
foreach (DataRow dr in dtMItems.Rows)
{
dr["MeetingName"] = item.Title;
dr["MeetingSiteUrl"] = web.Url + "/default.aspx?InstanceID=" + instanceID.ToString();
dtMItems.AcceptChanges();
}
dt.Merge(dtMItems);
} } }
dv = new DataView(dt, rowFilter, null, DataViewRowState.CurrentRows);
}
catch (Exception ex) {//Error}

return dv;
}

//Handler
pri
vate void objDataSource_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
e.ObjectInstance = this;
}
private void m_grid_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
try
{
m_grid.PageIndex = e.NewPageIndex;
m_grid.AllowGrouping = true;
m_grid.AllowGroupCollapse = true;
m_grid.GroupField = "MeetingName";
m_grid.GroupFieldDisplayName = "MeetingName";
m_grid.DataBind();
}
catch (Exception ex) {//Error }
}
}

Addin Your Comments for the Same.

Special Thanks: Ganesh Bankar

18 September 2009

KPI in WSS

I’m adding this article to produce KPI indicators for a simple task list which will show symbolic representation for each item added.

Here I have selected a task list in which I have added a calculated field named “Indicator” and these indicators are calculated from the priority field which is categorized (high, Medium & Low).
Here is the code snippet for calculated field.
="<DIV><IMG
src='/_layouts/images/kpipeppers-"&(3-RIGHT(LEFT(Priority,2),1))&".gif'
/></DIV>"
Now added the following script in content editor webpart

<script type="text/javascript">
var theTDs = document.getElementsByTagName("TD");
var i=0;
var TDContent = " ";

while (i < theTDs.length)

{
try
{
TDContent = theTDs[i].innerText theTDs[i].textContent;
if ((TDContent.indexOf("<DIV") == 0) && (TDContent.indexOf("</DIV>") >= 0))

{
theTDs[i].innerHTML = TDContent;
}

}
catch(err){}
i=i+1;
}////
ExpGroupRenderData overwrites the default SharePoint function
// This part is needed for collapsed groupings
//
function ExpGroupRenderData(htmlToRender, groupName, isLoaded)

{

var tbody=document.getElementById("tbod"+groupName+"_");
var wrapDiv=document.createElement("DIV");
wrapDiv.innerHTML="<TABLE><TBODY id=\"tbod"+ groupName+"_\"
isLoaded=\""+isLoaded+ "\">"+htmlToRender+"</TBODY></TABLE>";
var theTBODYTDs = wrapDiv.getElementsByTagName("TD"); var j=0; var TDContent = " ";
while (j < theTBODYTDs.length) {
try {
TDContent = theTBODYTDs[j].innerText theTBODYTDs[j].textContent;
if ((TDContent.indexOf("<DIV") == 0) && (TDContent.indexOf("</DIV>") >= 0))

{
theTBODYTDs[j].innerHTML = TDContent;

} }
catch(err){}
}
tbody.parentNode.replaceChild(wrapDiv.firstChild.firstChild,tbody);
}
</script>



Special thanks: Christophe




10 September 2009

Changing Welcome Page in SharePoint.

This article is targeting on changing the default.aspx page provided by SharePoint to our Custom Page.
Since altering default home page in publishing site is easily possible, however altering the home page for TEAM site is much trick than we can imagine.
Here is a solution that can be adopted to retain a custom or user defined home to be populated as default page after login to a SharePoint portal.

>> Follow these steps for achievement.
1. Check the Content Database of the web application via.
Central Administration >> Application Management >>SharePoint Web Application Management Tab >> Conect Database

2. Cross check the content database which through which we can alter the default page.
3. Create your custom page using SharePoint designer at root level which needs to be set as default page on login.


4. Go to MS SQL management Studio.
a. Browse to database table named “WelcomeNames
b. Add the Page name (ex: Myhomepage in my case) in LeafName Column and change its rank to 1.
Bingo! Now Login to the SharePoint portal and will get this page at default home page.

Special Thanks: Abhijeet Tidke

07 September 2009

Connecting Sharepoint 2007 to your Domino LDAP server

hi,
Here is a userful link provided by Mobile Viking, that will help to connect to Domino LDAP server to fetched login users for sharepoint.
The User connection and provider steps are similar as performed during FBA with slight alteration please follow the steps provided >> Click here

Special thanks: Mobile Viking(blog)

21 August 2009

SharePoint Timer Job/Scheduler

Hi,

This Article target's on development and deployment of timer job in SharePoint.
Lets begin creating a blank project and calling references of SPJobDefinition for assigned timer that will execute the functionality as needed by the timer job to execute. Along with this we are also creating a feature which will specify the trigger schedule.

Here I’m specifying the code snippet for the same.
Create a Class library project include all the SharePoint related references needed.
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
DEFINE JOB
Inherit the SPJobDefinition class which is a member for Sharepoint Administration

class ClassName:SPJobDefinition
{
internal const string TASK_NAME = "MYTimer" ;
public ClassName() : base(){
}


public ClassName (string jobName, SPService service, SPServer server, SPJobLockType targetType): base(jobName, service, server, targetType){
}

public ClassName (string jobName, SPWebApplication webApplication)
: base((jobName, webApplication, null, SPJobLockType.Job) {
this.Title = "MYTimer" ;
}
//Override the Execute function
public override void Execute(Guid targetInstanceId) {
//Calling our function which needs to be executed
MYfunction();
//base.Execute(targetInstanceId);
}
public void MYfunction() {
try
{
SPSite osite = new SPSite( "SiteURL" );
//SPSite osite = SPContext.Current.Site;
SPWeb oweb = osite.OpenWeb();
oweb.AllowUnsafeUpdates = true;
if (oweb.Lists[ "Tasks" ] != null)
{
SPList olist = oweb.Lists[ "Tasks" ];
SPListItem newTask = olist.Items.Add();
newTask[ "Title" ] = DateTime.Now;
newTask.Update();
}
}
catch (Exception ee) { //Add you Exceptions catch }
}
}

Add a new class item for Feature Creation
//Feature creation
class MyclassInstaller:SPFeatureReceiver {
internal const string TASK_NAME = "MYTimer" ;

public override void FeatureInstalled(SPFeatureReceiverProperties properties) {
}
public override void FeatureUninstalling(SPFeatureReceiverProperties properties) {
}
public override void FeatureActivated(SPFeatureReceiverProperties properties) {
// register the the current web
SPSite site = properties.Feature.Parent as SPSite;

// make sure the job isn't already registered
foreach (SPJobDefinition job in site.WebApplication.JobDefinitions)
{
if (job.Name == TASK_NAME)
job.Delete();
}
TaskLoggerJob taskLoggerJob = new TaskLoggerJob(TASK_NAME, site.WebApplication);

// For Minute Trigger
SPMinuteSchedule schedule = new SPMinuteSchedule();
schedule.BeginSecond = 0;
schedule.EndSecond = 59;

//Intervals define the Minute Time Gap between triggers ex-2= min gap for timer trigger
schedule.Interval = 2;
taskLoggerJob.Schedule = schedule;
taskLoggerJob.Update();
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
SPSite site = properties.Feature.Parent as SPSite;

// delete the job
foreach (SPJobDefinition job in site.WebApplication.JobDefinitions)
{
if (job.Name == TASK_NAME)
job.Delete();
}
}
}

DEPLOYMENT
The best way to deploy the time project is by creating a WSP either can use WSP builder or NANT for creating a WSP.
But Before we deploy this solution we need to add its FEATURE.XML in 12 hives feature folder with naming Feature conventions as here i have termed "MyTimer". You can manually add this file in this folder structure with following tags in it :
Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="DA1B534E-08D9-41ef-B2C4-B656E9389D80"
Title="MYTimer" Description="Installs the task MY timer job feature to the current site collection."
Scope="Site"
Hidden="TRUE"
Version="1.0.0.0"
ReceiverAssembly="MYSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3aeda64f0b993534"
ReceiverClass="MYSite.MyclassInstaller"

>
Once a WSP is created you follow the same procedures as recommended i.e
1. Add Solution
2. Deploy Solutions
3. Install Feature
4. Activate Feature.


STSADM Commands for WSP Deployment
pushd %programfiles%\common files\microsoft shared\web server extensions\12\bin
@Echo ------Adding Sol------
stsadm -o addsolution -filename
file://wsppath%20/MyTimer.wsp
stsadm -o execadmsvcjobs
@Echo ------deploy Sol----
stsadm -o deploysolution -name MyTimer.wsp -allowGacDeployment -local -force
stsadm -o execadmsvcjobs
iisreset
@echo -----Feature added-----
stsadm -o installfeature -filename MyTimer\feature.xml -force
stsadm -o activatefeature -filename MyTimer\feature.xml -url siteURL
-force
stsadm -o execadmsvcjobs
iisreset




There goes you can check timer execution in Timer job status & Timer job definitions in central administration which details the execution time and its status for success.

Just a Quick information of all the inbuilt Timer in sharepoint Sorted by Neil Click here

Here are the snipplets for Weekly, Monthly & Annual.

Hourly(Triggers @ Every Hour 01.Min)
SPHourlySchedule JobSchedule = new
SPHourlySchedule();

JobSchedule.BeginMinute = 1;
JobSchedule.EndMinute = 2;


Weekly (Triggers @ Thursday 04:01:00PM)

SPWeeklySchedule JobSchedule = new SPWeeklySchedule();
JobSchedule.BeginDayOfWeek = DayOfWeek.Thursday;
JobSchedule.EndDayOfWeek = DayOfWeek.Thursday;
JobSchedule.BeginHour = 16;
JobSchedule.EndHour = 16;
JobSchedule.BeginMinute = 01;
JobSchedule.EndMinute = 05;
JobSchedule.BeginSecond = 00;
JobSchedule.EndSecond = 00;
taskLoggerJob.Schedule = JobSchedule;

Monthly (Triggers @ First Day(01) of the Month, at 10:15:00AM)
SPMonthlySchedule JobSchedule = new SPMonthlySchedule();
JobSchedule.BeginDay = 1;
JobSchedule.EndDay = 1;
JobSchedule.BeginHour = 10;
JobSchedule.EndHour = 10;
JobSchedule.BeginMinute = 15;
JobSchedule.EndMinute = 25;

JobSchedule.BeginSecond = 00;
JobSchedule.EndSecond = 00;

Annually (Triggers @ April 21, at 10:15 AM)
SPYearlySchedule JobSchedule = new SPYearlySchedule();
JobSchedule.BeginMonth = 4;
JobSchedule.EndMonth = 4;
JobSchedule.BeginDay = 21;
JobSchedule.EndDay = 21;
JobSchedule.BeginHour = 10;
JobSchedule.EndHour = 10;
JobSchedule.BeginMinute = 15;
JobSchedule.EndMinute = 25;
JobSchedule.BeginSecond = 00;
JobSchedule.EndSecond = 00;

Addin your comments for this article.


Special Thanks: Andrew Connell, Ganesh Bankar.

03 August 2009

Reporting Services For Sharepoint

Here is a Best article i have read related to SSRS (SQL Server Reporting Services) for SharePoint blogged by Charles Emes.
Click Here to Know More

31 July 2009

Comparison between Visual Studio & SharePoint Designer Workflows

Here i'm added Key differences between Custom Visual Studio and SharePoint Designer workflow.
----

Authoring:


Visual Studio: >>Full development environment with a graphical designer that produces a template which can be associated with multiple sites, lists, and content types

Designer:>> Wizard-driven interface that utilizes conditions and actions to produce a template that contains a set of declarative rules and is bound to a specific list

Custom .NET code :

Visual Studio: >>Yes

Designer:>> No

Types:

Visual Studio: >>Sequential, State Machine

Designer:>> Sequential only

Completed Workflow:


Visual Studio: >>Workflow markup file and code-behind files are compiled into workflow assembly.

Designer:>> Workflow markup, workflow rules, and supporting files are stored uncompiled in a hidden document library on the site and compiled on demand.

Debugging:


Visual Studio: >>Yes. Visual Studio 2005 debugging except for JIT exceptions.

Designer:>> No step-by-step debugging available

Deployment:

Visual Studio: >>Packaged as a SharePoint feature and deployed to the server by an administrator

Designer:>> Deployed automatically when workflow is completed

Association:

Visual Studio: >>Template must be associated with each and every list before it will be available

Designer:>> Association occurs at design time only

Workflow Forms

Visual Studio: >> Can use any forms technology, such as InfoPath 2007 or ASP.NET 2.0 forms

Designer:>> Automatically generates ASP.NET 2.0 forms, which can then be customized

Create Custom Activities and Conditions


Visual Studio: >>Yes

Designer:>> No. Must use a predefined set of activities and conditions.

Workflow Modification

Visual Studio: >>Executing workflows can be modified.

Designer:>> No modification is possible.

-------

click here For more details..


Special Thanks :Amit Pasalkar.





20 July 2009

Form Based Authentication in SharePoint


(A Step Wise Implementation of FBA in SharePoint)
Here I’m adding this article to implement and extend the existing portal and have accessibility using Form Based Authentication. The article below has step wise implementation from scratch.
--
1. Create SQL Database: using Visual Studio 2005 command Prompt.

2. Use command : ASPNET_REGSQL



3. Please Select “ Configure SQL Server for Application Services
4. Enter the Server Name Authentication and the Database Name

(Please Add the Database Name of our choice :ex-newFBADatabase)


5. Continue till > finish.
6. Check Newly Created Database containing necessary tables and store procedures


7. Extend your web application in any of the prescribed zone (Internet, intranet, extranet, Custom)

a. The original web application is at port 333 (in this case).
b. We have extended to port 332 as shown and selected the zone as extranet.


8. Now In visual Studio (VS) create a web site and add following entries in web.config file.

<!--SQL CONNECTION STRING-->

<connectionStrings>
<
add name="FBAConnectionString" connectionString="Data Source=MYDATABASE;Initial Catalog=FBAUSERS; Integrated Security=True"/>

</connectionStrings>
<system.web>

<!--
Membership Provider For FBA -->


<
membership defaultProvider="FBADemoMember">

<providers>

<add connectionStringName="FBAConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"
maxInvalidPasswordAttempts
="5"
minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="FBADemoMember"
type="System.Web.Security.SqlMembershipProvider,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</membership>

<!-- role provider For FBA -->

<roleManager enabled="true" defaultProvider="FBADemoRole" >

<providers>
<
add connectionStringName="FBAConnectionString" applicationName="/" name="FBADemoRole"
type="System.Web.Security.SqlRoleProvider,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</roleManager >




9. Select website > ASP.NET configuration in VS



10. Select Security hyperlink



11. Create Roles as needed.






12. Create Roles (Inside Create or Manage Roles)



13. Create Users
14. Create Users(Inside Create Users)




(~) From Central Administration
15. Select Authentication Provider in Application Security in central admin



16. Select the Web Application and select the extended Zone for FBA.


17. Select Authentication Type :
a. FORMS,
b. Membership Provider Name : same membership defaultProvider as in web.Config
c. similarly for Role Manager Name: roleManager defaultProviderd.

Enable Anonymous Access optional (depends on requirement)




18.Now Update the Extended Web Application Web.Config Place beneath <>tag in both (original and extended web application) web.config file. Also place & beneath in conjunction with connection string as shown below.



19. Add the FBA User in the original portal/Web Application through People and Groups.


20. Add user in the Defined Role/Groups As you can observe here the user will be present as FBADemoMember:

21. Now Login in the extended Site.
22. Bingo- Welcome the FBA users.



Thanks…..








15 July 2009

SharePoint Installation on VISTA OS

Hey!
Bamboo Nation's has come up with a solution which will allow all the VISTA operating system user to get SharePoint (WSS 3.0) installed on their system.
For more Details click here.



13 July 2009

Active Directory & Sharepoint Users

Including User from Active Directory in sharpeoint internally had few process, However you need to be clear about the difference between SharePoint users used for security and Profiles. These are related.
First Profiles.
1. Moss is setup to import all the users in your AD domain as profiles into the SSP that you create. However, this action is not scheduled. Profiles will not be imported until you either do a manual import or setup the schedule for Full and incremental imports. This imparts no security rights to the user at all.
2. After the profiles have been imported. If a user is deleted in AD then after 3 successive full profile imports there profile will be deleted also. If deactivated their MySite will be cleaned up, but not their profile.

---

Authentication/Authorization (Assuming you are not using any kind of Forms Based Authentication)
1. SharePoint depends on Windows Authentication via IIS to establish the user's identity. (this happens completely external to SharePoint)
2. SharePoint checks the user's AD identity and group membership, as established in #1, to see what the user has the ability to do in SharePoint. You can successfully authenticate and still not gain access to SharePoint.
3. Security Access in SharePoint is dependent on the AD identity or an AD group of which the user is a member being added as a SharePoint user. Or the user or group may be added directly to a SharePoint group. This will allow the user to gain access to SharePoint resources.
4. If the access is through group membership then the user's identity will only be added to SharePoint when the user logs in and submits something to a document library or list. This adds their identity as a user, but doesn't directly re-associate them with specific rights. The rights are still gained through group membership. But they would now show up in the People and Groups list.
5. If the user's account is deactivated or deleted in AD their account in SharePoint is NOT deleted, but they won't be able to use it to access SharePoint anymore because AD won't be able to authenticate them so they'll never get to Authorization. If deactivated, you will still be able to click on their name attached to documents or list items and see their profile. If deleted clicking on these items will normally lead to an error page because the profile isn't there anymore.
6. Removing SharePoint users can be done programmatically, but it is a fairly involved process requiring walking each object in the FARM and looking for the user entries. There are 3rd party products that do this, but I don't normally recommend using them since you are destroying the history of the user in the system.
----

Special Thanks: Paul Stork.

.

09 July 2009

SharePoint : Popfly as Iframe

--SharePoint & Popfly --
Popfly comes with huge functional block and mashup integrated with Silverlight to give a enhanced branding with minimum efforts.
Here is a simple example which will help you to get a connected popfly blocks and later inherit the same into SharePoint environment. Since Popfly is also compatible with Visual studio environment which brings smile to all my developer friends to explore & perform more.
Before you begin make sure you register or use your windows Live ID. As you login this will create special Profile ID which will track all your project created, shared or inherited in popfly.



  1. Popfly provides various functionality while creating such as Game, Mashup, block, data & webpage. Today i'll be Creating a Mashup Block.


  2. To begin we will drag the Block(s) you wanted from various blocks list/groups provided by popfly.

  3. Since we have selected a live Image Search we needed a runtime input parameter hence we have added a input block which is connected as a input for the search block.

  4. Its setting signifies the function and the input staged for each blocks. As there are ample of blocks provided as well as shared by other users which can be user, also custom block can also be create as needed.


  5. Before we Execute (Run) its is suggested to save the project. Once saved Now we can execute and view output by Clicking the Run Button.


  6. Once the Output satisfies our needs we can go ahead with integration with our application(SharePoint) by clicking Share which provides few sharing options, Now click on the Embed option. Since Microsoft Popfly provides this functionality to share this block in our defined application


  7. Now you get is a script tagged in iframe, as my choice of application is SharePoint all I did by adding this Script in the Source Editor of a Content editor web Part .

  8. Thus Popfly Start populated in the sharepoint Enviroment

Go Ahead and Explore..
--

Subscribe in a reader




07 July 2009

Replacing Time field

SharePoint provides date time field in a fixed format, However we can further organized to have a hourly/minute counter to view its last updates/modification.
This can be achieved by using a simple Content Editor Web part[CEWP] and Script for converting "DD/MM/YYYY hh:mm" to minutely incremental field.

Add the following sniplet in the source script section fo the CEWP.

<--Code-->

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var str = "Last Updated"; //change
this based on col header

var today = new Date();
today = Date.parse(today)/1000;
var a=0;
var headers = $("table.ms-listviewtable:first>
tbody> tr:first th"
).get();
$.each(headers, function(i,e){
x = $(e).contents().find("a[title*='"+str+"']").length;
a = x > 0 && i > a ? i : a;
});
var dArray = $("table.ms-listviewtable:first>
tbody> tr:gt(0)"
).find(">td:eq("+a+")").get()
$.each(dArray, function(i,e){
var d1 = Date.parse($(e).text())/1000;
var dd = (today-d1)/86400;
var dh = (dd-Math.floor(dd))*24;
var dm = (dh-Math.floor(dh))*60;
var time = ((Math.floor(dd) > 0 ? Math.floor(dd) +" days, " : "")+
(Math.floor(dh) > 0 ? Math.floor(dh)+" hrs, " : "")+
(Math.floor(dm)+" min"));
$(e).text(time);
});
});
</script>
Special Thanks: Paul Grenier


Rate Now: