About Me

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

Thursday, August 28, 2008

Add a flash material into sharepoint site

1) First go to the site & Click Edit page
2) Then Add a content editor to the page
3) Click Source Editor
4) Add following Code

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
WIDTH="550" HEIGHT="400" id="myMovieName">



NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">

Tuesday, August 26, 2008

Add users programmatically into a SHAREPOINT cutomlist(VERY RARE)

private string setAssignedPeopleStirng(string pstrIDS)
{
try
{
string[] strArrNames = pstrIDS.Split(new char[] { ';' });
string strSend = string.Empty;
SPWeb web = MySite.AllWebs[WebSite];
SPUserCollection MLUserGroup = web.SiteUsers;
for (int count = 0; count <>
{
string strusreName = MLUserGroup.GetByID(int.Parse(strArrNames[count])).Name;
strSend += strArrNames[count].Trim() + ";#" + strusreName + ";#";
}
return strSend;
}
catch
{
return string.Empty;
}
}

Wednesday, August 20, 2008

Active directory acces to get Telephone number

public Hashtable getUserTelephoneNumbers()
{
try
{
Hashtable arrNames = new Hashtable();
int count = 0;
string domain = "172.21.0.255";
DirectoryEntry de = new DirectoryEntry("LDAP://" + domain);
de.Username = "MS\\Administrator";
de.Password = "password";
DirectorySearcher ds = new DirectorySearcher(de);

ds.Filter = "(&(objectClass=user)(objectCategory=person))";

ds.Sort.Direction = System.DirectoryServices.SortDirection.Ascending; ds.SearchScope = SearchScope.Subtree;
ds.PageSize = 4000;
count++;

try
{
SortedList objSortedList = new SortedList();

foreach (SearchResult result in ds.FindAll())
{

DirectoryEntry deTemp = result.GetDirectoryEntry();

try

{

arrNames.Add(deTemp.Properties["cn"].Value.ToString(), deTemp.Properties["TelephoneNumber"].Value.ToString());

}

catch (Exception ex)
{
ex.Message.ToString();
}

}

}

catch (Exception ex)
{
//HttpContext.Current.Response.Write(ex.ToString());
}

finally
{
}
return arrNames;

}

catch
{
return null;

}

}

Get E-mails of all users in a SPGroup

SPWeb web = site.AllWebs

[ConfigurationManager.AppSettings["WEB_SITE"].ToString()];
SPGroup group = web.Groups[0];
SPUserCollection MLUserGroup = web.SiteUsers;
String strUserGroupName = MLUserGroup.GetByID(27).Groups[0].Name

Tuesday, August 5, 2008

CAML query with a filter between DateTime's

SPQuery query = new SPQuery();

query.Query = "<Where><And><Geq><FieldRef Name="Created" /><Value Type="DateTime" IncludeTimeValue='FALSE'>" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(ddtStartDate) + "</Value></Geq>" +

"<Leq><FieldRef Name="Created" /><Value Type="DateTime" IncludeTimeValue='FALSE'>" +

SPUtility.CreateISO8601DateTimeFromSystemDateTime(ddtEndDate) + "</Value></Leq></And></Where>";

SPListItemCollection collection = list.GetItems(query);<Query>

<Where> <Eq> <FieldRef Name="CatalogItem" LookupValue="TRUE" /> <Value Type="Lookup">Value Goes Here</Value> </Eq> </Where> </Query> <where> <eq> <fieldref name="PersonFieldName"/> <value type="User">User Display Name</value> </eq> </where>

My Masters