Tuesday, January 19, 2010
Thursday, January 14, 2010
How set distinct value to dropdown list
private void FillInt()
{
using (SPSite site = SPContext.Current.Site)
{
using (SPWeb web = site.OpenWeb())
{
web.Lists.IncludeRootFolder = true;
SPList ChartList = web.Lists["Organization Charts"];
//query.Query = "USA ";
SPQuery query = new SPQuery();
query.Query = " ";
SPListItemCollection listItems = ChartList.GetItems(query);
foreach (SPListItem listItem in listItems)
{
FillDropDownList(listItem, ddlGroup, "field");
}
}
}
}
private void FillDropDownList(SPListItem listItem,DropDownList ddlTemp, string fieldName)
{
if (null == ddlTemp.Items.FindByText(listItem[fieldName].ToString()))
{
ListItem ThisItem = new ListItem();
ThisItem.Text = listItem[fieldName].ToString();
ThisItem.Value = listItem[fieldName].ToString();
ddlTemp.Items.Add(ThisItem);
}
}
{
using (SPSite site = SPContext.Current.Site)
{
using (SPWeb web = site.OpenWeb())
{
web.Lists.IncludeRootFolder = true;
SPList ChartList = web.Lists["Organization Charts"];
//query.Query = "
SPQuery query = new SPQuery();
query.Query = "
SPListItemCollection listItems = ChartList.GetItems(query);
foreach (SPListItem listItem in listItems)
{
FillDropDownList(listItem, ddlGroup, "field");
}
}
}
}
private void FillDropDownList(SPListItem listItem,DropDownList ddlTemp, string fieldName)
{
if (null == ddlTemp.Items.FindByText(listItem[fieldName].ToString()))
{
ListItem ThisItem = new ListItem();
ThisItem.Text = listItem[fieldName].ToString();
ThisItem.Value = listItem[fieldName].ToString();
ddlTemp.Items.Add(ThisItem);
}
}
How to get distinct value from CAML query
Many times, we face a challenge to get unique rows froma CAML query. The main problem is that CAML does not have any feature to get the distinct rows in one go.
Way Around:
We all know that CAML query returns SPListItemCollection and we can convert the outcome to data table also.
We can convert the resultant datatable to dataview and again convert the dataview to datatable by using ToTable and arguments :
Distinct = true
and column name
So..
suppose we have SPWeb object as 'web' so
DataTable DT= web.GetSiteData(qry);
DataView v = new DataView(tbl);
return v.ToTable(true, "Type");
This code snippets returns the distinct rows by comparing column name "Type".
copy from: http://firstblogofvarun.blogspot.com/2009/05/how-to-get-distinct-value-from-caml.html
Way Around:
We all know that CAML query returns SPListItemCollection and we can convert the outcome to data table also.
We can convert the resultant datatable to dataview and again convert the dataview to datatable by using ToTable and arguments :
Distinct = true
and column name
So..
suppose we have SPWeb object as 'web' so
DataTable DT= web.GetSiteData(qry);
DataView v = new DataView(tbl);
return v.ToTable(true, "Type");
This code snippets returns the distinct rows by comparing column name "Type".
copy from: http://firstblogofvarun.blogspot.com/2009/05/how-to-get-distinct-value-from-caml.html
Thursday, January 7, 2010
Wednesday, January 6, 2010
copy assembly from GAC
use the command line to copy the file from (for an assembly called system.core, version 3.5.0.0, culture=neutral, publickeytoken=b77a5c561934089)
Final command:
copy C:\windows\assembly\GAC_MSIL\system.core\3.5.0.0__b77a5c561934089\system.core.dll c:\
Final command:
copy C:\windows\assembly\GAC_MSIL\system.core\3.5.0.0__b77a5c561934089\system.core.dll c:\
Friday, September 25, 2009
Debugging Web Parts - a full explanation of the requirements
http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=60
CallStack=true
debug=”true”
level=”Full”
mode=”Off” in the node
CallStack=true
debug=”true”
level=”Full”
mode=”Off” in the
Wednesday, September 9, 2009
Customizing the Content Query Web Part and Custom Item Styles
http://www.heathersolomon.com/blog/articles/CustomItemStyle.aspx
http://blogs.edork.com/MikeGeyer/Lists/Posts/Post.aspx?ID=20
http://blogs.edork.com/MikeGeyer/Lists/Posts/Post.aspx?ID=20
Tuesday, September 8, 2009
Tuesday, August 25, 2009
Monday, August 17, 2009
Get all Document Library List
This discards all items except those marked as Files/Documents.
CrossListQueryInfo clqi = new CrossListQueryInfo();
clqi.Query = @"
clqi.ViewFields = "
clqi.Lists = "
clqi.Webs = "
clqi.UseCache = true;
clqi.RowLimit = (documentCount==0) ? 5 : (uint)documentCount;
CrossListQueryCache clqc = new CrossListQueryCache(clqi);
DataTable dt = clqc.GetSiteData(SPContext.Current.Site, CrossListQueryCache.ContextUrl());
Thursday, August 6, 2009
Stop Office Sharepoint Search server
pskill \\sharepointservername mssearch
Detail:
http://social.technet.microsoft.com/Forums/en-US/sharepointsearch/thread/9b313d05-73e3-4c3a-ac18-39fefaa4352a
PSTools Downloads:
http://technet.microsoft.com/en-us/sysinternals/dd443648.aspx
Detail:
http://social.technet.microsoft.com/Forums/en-US/sharepointsearch/thread/9b313d05-73e3-4c3a-ac18-39fefaa4352a
PSTools Downloads:
http://technet.microsoft.com/en-us/sysinternals/dd443648.aspx
Sunday, August 2, 2009
CALM
http://elczara.spaces.live.com/blog/cns!554EC06D366AC9D5!681.entry
PARENT ELEMENT
ELEMENT
DESCRIPTION
Where Used within the context of a query to specify a filter.
And Used within the Where element to group filters in a query for a view.
Or Used within the Where element to group filters in a query.
BeginsWith Searches for a string at the start of a column that holds Text or Note field type values.
Contains Searches for a string anywhere within a column that holds Text or Note field type values.
Eq Arithmetic operator that means "equal to" and is used within a query.
Geq Arithmetic operator that means "greater than or equal to." This element can be used within a Where element in a query.
Gt Arithmetic operator that means "greater than." This element is used similarly to the Eq and Lt elements.
Leq Arithmetic operator that means "less than or equal to." The Leq element is used in view queries similarly to the Eq and Geq elements.
Lt Arithmetic operator that means "less than" and is used in queries in views. This element is used similarly to the Eq and Gt elements.
Neq Arithmetic operator that means "not equal to" and is used in queries.
DateRangesOvelap Used in queries to compare the dates in a recurring event with a specified DateTime value, to determine whether they overlap.
IsNotNull Used within a query to return items that are not empty (Null).
IsNull Used within a query to return items that are empty (Null).
OrderBy Determines the sort order for a query. The OrderBy element contains a group of FieldRef elements.
GroupBy Contains a Group By section for grouping the data returned through a query in a list view.
Thanks.
PARENT ELEMENT
ELEMENT
DESCRIPTION
Where Used within the context of a query to specify a filter.
And Used within the Where element to group filters in a query for a view.
Or Used within the Where element to group filters in a query.
BeginsWith Searches for a string at the start of a column that holds Text or Note field type values.
Contains Searches for a string anywhere within a column that holds Text or Note field type values.
Eq Arithmetic operator that means "equal to" and is used within a query.
Geq Arithmetic operator that means "greater than or equal to." This element can be used within a Where element in a query.
Gt Arithmetic operator that means "greater than." This element is used similarly to the Eq and Lt elements.
Leq Arithmetic operator that means "less than or equal to." The Leq element is used in view queries similarly to the Eq and Geq elements.
Lt Arithmetic operator that means "less than" and is used in queries in views. This element is used similarly to the Eq and Gt elements.
Neq Arithmetic operator that means "not equal to" and is used in queries.
DateRangesOvelap Used in queries to compare the dates in a recurring event with a specified DateTime value, to determine whether they overlap.
IsNotNull Used within a query to return items that are not empty (Null).
IsNull Used within a query to return items that are empty (Null).
OrderBy Determines the sort order for a query. The OrderBy element contains a group of FieldRef elements.
GroupBy Contains a Group By section for grouping the data returned through a query in a list view.
Thanks.
Wednesday, June 10, 2009
Sunday, June 7, 2009
Monday, June 1, 2009
WSS Field Names for Lists & Document Libraries
http://blog.thekid.me.uk/archive/2007/03/21/wss-field-display-amp-internal-names-for-lists-amp-document-libraries.aspx
Wednesday, May 27, 2009
hide show file vb script
Set sh = CreateObject("WScript.Shell")
theKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden"
setHidden = sh.RegRead(theKey)
If setHidden = 1 Then
setHidden = 0
MsgBox "System and hidden files will no longer appear in Explorer.",64,"Hidden File Exchange"
Else
setHidden = 1
MsgBox "System and hidden files will appear in Explorer.",64,"Hidden File Exchange"
End If
sh.RegWrite theKey,setHidden,"REG_DWORD"
Set sh = Nothing
Thursday, May 14, 2009
Monday, May 11, 2009
Get Current User Group
http://blogs.tamtam.nl/duarte/default,month,2008-12.aspx
SPGroupCollection spGroups =
SPContext.Current.Web.CurrentUser.OwnedGroups;
foreach (SPGroup group in spGroups)
{
output.Write(group.Name);
foreach (SPUser user in group.Users)
{
output.Write(user.Name);
}
}
Subscribe to:
Posts (Atom)