Posts

Showing posts from 2012

Add multiple lookup field programmatically sharepoint 2010-client object model

Add multiple lookup field programmatically sharepoint 2010 -client object model Insert the following namespace using Microsoft.SharePoint; using Microsoft.SharePoint.Client; Use the following code.    ClientContext ccsite;    List listobj;    List listobj_lookup;             //Object for lookup list    ListItemCollection _icoll;   public MainPage()       {            InitializeComponent();             ccsite = new ClientContext(ApplicationContext.Current.Url);            ccsite.Load(ccsite.Web);            listobj = ccsite.Web.Lists.GetByTitle( "ListName" );            listobj_lookup= ccsite.Web.Lists.GetByTitle( "ListNa...

sharepoint add lookup field programmatically-client object model

Add lookup field programmatically sharepoint 2010-client object model Insert the following namespace using Microsoft.SharePoint; using Microsoft.SharePoint.Client; Use the following code.    ClientContext ccsite;    List listobj;    List listobj_lookup;             //Object for lookup list    ListItemCollection _icoll;   public MainPage()       {            InitializeComponent();             ccsite = new ClientContext(ApplicationContext.Current.Url);            ccsite.Load(ccsite.Web);            listobj = ccsite.Web.Lists.GetByTitle( "ListName" );            listobj_lookup= ccsite.Web.Lists.GetByTitle( "ListName" );...

unable to load workflow actions from the server. please contact your server administrator

Image
unable to load workflow actions from the server. please contact your server administrator:    This error will happen because of your deployed webparts(that may be not present or not deployed correctly).    So you cant open or create a work flow. To solve this: 1.Open web.config file from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS Change the following in web.config <customErrors mode = " Off " />     2.In your site go to  site actions->site settings->site administration ->workflow There it will show in which web part error is present. 3.Go to central administrator system settings->farm management->manage farm solutions there you will find all the deployed web parts.Just click on the error web part which was shown in above step.And click Retract solution and click ok. 4.Again go to your site error page(mentioned in step 2). Refresh the page. If there is ...

customerrors mode= on defaultredirect= mycustompage.htm / sharepoint

customerrors mode= on defaultredirect= mycustompage.htm   Error Message: Server Error  in   '/'  Application. ----------------------------- Runtime Error <!-- Web.Config Configuration File -->  <configuration>      <system.web>        <customErrors mode= " Off " />     </system.web>    </configuration>    <!-- Web.Config Configuration File --> < configuration> <system.web> <customErrors mode = " RemoteOnly " defaultRedirect = " mycustompage .htm" /> </system.web> </configuration>   To Find Solution: Open web.config file from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS Change the following in web.config and you will be able to see the detailed error. <customErrors mode ...

messagebox result c#

messagebox result c# C# code: MessageBoxResult result = MessageBox .Show(" your message! ", "MessageBox heading" , MessageBoxButton .OKCancel);   if (result == MessageBoxResult .OK)  {    //Your Code  }

Add update and delete list items programmatically in sharepoint-client object model

Add update and delete list items programmatically in sharepoint-client object model: Insert the following namespace using Microsoft.SharePoint; using Microsoft.SharePoint.Client; Use the following code.    ClientContext ccsite;    List listobj;    ListItemCollection _icoll;     public MainPage()         {            InitializeComponent();             ccsite = new ClientContext(ApplicationContext.Current.Url);            ccsite.Load(ccsite.Web);            listobj = ccsite.Web.Lists.GetByTitle( "ListName" );            ccsite.Load(listobj);                   ...

get list items in sharepoint 2010 c# using client object model:

get list items in sharepoint 2010 c# using client object model: Insert the following Namespace: using Microsoft.SharePoint; using Microsoft.SharePoint.Client; Use the following code.         ListItemCollection _icoll;         public MainPage()         {            InitializeComponent();            ClientContext  ccsite = new ClientContext(ApplicationContext.Current.Url);            ccsite.Load(ccsite.Web);            List   listobj = ccsite.Web.Lists.GetByTitle( "ListName" );            ccsite.Load(listobj);                   ...

add update and delete list items programmatically in sharepoint (Server Object Model) :

Add update & delete sharepoint list item programmatically using c#  ( Server Object Model) : First insert the following name space                   using Microsoft.SharePoint; For Adding list item:   protected void Page_Load( object sender, EventArgs e)         {           SPSite site = SPContext .Current.Site;           SPWeb web = SPContext .Current.Web;           SPList listobj = web.Lists[ "ListName "];            //add new item             SPListItem litem = listobj.AddItem();             litem[ "ColumnName1" ] = "one" ;    ...

retrieve sharepoint list data c#

Retrieve sharepoint list data using c#(server object model):    First insert the following name space                   using Microsoft.SharePoint;    Use the following code to retrive  list data   protected void Page_Load( object sender, EventArgs e)         {           SPSite site = SPContext .Current.Site;           SPWeb web = SPContext .Current.Web;           SPList listobj = web.Lists[ "ListName "];           SPQuery qry = new SPQuery ();           qry.Query = "<view/> ";           SPListItemCollection _icoll = listobj.GetItems(qry);  ...

Solve - This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator.

Image
Solve - This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator.     You may have this kind of error when you open a list.To solve this problem do the following Setps: 1.Open central administration->Application Management->manage web application 2.Select your web application from the list of web application(after that the ribbons on the top will be enabled) 3.click on General settings.( Note:do not click on the settings icon, it will take you to setting page. click on below the icon,from the dropdown menu select Resource Throttling ) 4.In that On the Resource Throttling page, check the list view lookup. increment the value  5.Click ok. thats it.

How to grant permission to a SharePoint page:

Image
How to grant permission to a group to access specific Page in SharePoint:     It is very simple process. We have to create a  group and add the group to the page thats it.. see the example. step 1:    Site Actions->Site Permissions->Create Group Step 2:     Give group name and give permission level to this group then click ok     Step 3:    New->Add Users->(here add the users that you want to access the page) Step 4:     Then go to your page->click on page->permissions Step 5:     Click on stop inheriting permissions and ok Step 6:    And now remove all the groups displayed in that page Step 7:     After removing all groups now click->Grand Permissions->type the group name that we created->give permissions->click ok Thats it.. now the members of the group only able to view this page..(except site collection a...

programatically highlight words using c#:

Image
programatically highlight words using c#:         Your output like this.... xaml:     create a text block with name of tb.  < TextBlock Height =" auto " TextWrapping =" Wrap "  Width =" 200 " HorizontalAlignment =" Left " Margin ="45,12,0,0" Name =" tb " Text =" Textblock "  VerticalAlignment =" Top " /> c# code:          string source = " This is a example of Highlight a word using c# ";   //Your source         string [] highlight_words = { " example ", " word " };                          //Your Key word On your button click event call this function like this          private void button1_Click( object sender, RoutedEventArgs e)       ...

Silverlight Chart: Displaying Data Above the Column

Image
Columnseries bar value in top of the column in silverlight chart:    Your final output will come like this XAML code:    Add the following xaml code in your chart < toolkit:Chart Canvas.Top= " 80 " Canvas.Left= " 10 " x:Name= " chartname " Margin= " 88,68,312,114 ">                       < toolkit:Chart.Series >                 < toolkit:ColumnSeries Title= " week1 " IndependentValueBinding= "{Binding Path = Value }" DependentValueBinding= "{Binding Path = Key }">                     <toolkit:ColumnSeries.DataPointStyle>                        ...

change column/bar/area series datapoint's color of columnseries chart in silverlight

Image
change column/bar/area series datapoint's color  in silverlight:   Your Final output will be like this. Xaml Code:      Add the Following Code in your xaml < toolkit:Chart Canvas.Top =" 80 " Canvas.Left =" 10 " x:Name= " chart _ name " Margin= "88,68,312,114">                       < toolkit:Chart.Series >                 < toolkit:ColumnSeries Title= " week1 " IndependentValueBinding= "{Binding Path = Value }" DependentValueBinding= "{Binding Path = Key }">                     < toolkit:ColumnSeries.DataPointStyle >                       ...

Silverlight Chart Example

Image
Silverlight Chart Example :                           In this example i explained  how to create a Column series chart in silverilght. I directly go to the coding part.In this example i added 3 column series inside the chart.If you want to single column series you can just add one column series inside the chart. OutPut Screen  :   Xaml Code : Paste the following code between user control  < Grid x:Name =" LayoutRoot " Background=" White ">         < toolkit:Chart HorizontalAlignment ="Left" Margin ="12,12,0,0" Name=" chart1 " Title ="Chart Title" VerticalAlignment="Top" Height="266" Width="365">             < toolkit:ColumnSeries DependentValuePath ="X" IndependentValuePath ="Y" ItemsSource ="{ Binding }" DependentValueBinding ="{Binding Value1}" IndependentValueBinding=" {Binding Name }"/>     ...

display minimum and maximum values for LinearAxis in Silverlight Toolkit's columnseries

Image
minimum/maximum values & showgridline propertie s in silverlight chart axis:      Add the following XAML code,above the last line of your chart. see the following image code:   < toolkit:Chart.Axes >        < toolkit:LinearAxis Orientation= "Y" Minimum= " 0 " Maximum= " 100 "  Height= " auto"/>       </ toolkit:Chart.Axes > You can set intervels & show or hide gridlines also:     For example in that same code you can add intervel property. example   < toolkit:Chart.Axes >        < toolkit:LinearAxis Orientation= "Y" ShowGridLines =" False " Minimum= " 0 " Maximum= " 100 " Interval =" 20 "  Height= " auto"/>       </ toolkit:Chart.Axes >  Output:  

count number of occurrences in string c#

count number of occurrences in string c#   First use the following namesapce           using System.Text.RegularExpressions;    Use the following Regx code to count             string source= "one two three one two one"            int count = Regex.Matches(source, "\\b(" + Yourstring + ")\\b" ).Count;   that "\\b(" is used for eliminate specal charcter.

how to get string between two strings in c#

how to get string between two strings in c# Example:     string source= "one two three four five"    If you want to get strins between "one" and "five" then use this function call    string temp = GetStringBetween( "one " , "five" , source); And the copy the following function & paste in your program.   public static string GetStringBetween( string strbegin, string strend, string source)         {             int iIndexOfBegin = source.IndexOf(strbegin) + strbegin.Length;             string s1 = source.Substring(iIndexOfBegin);             int iIndexOFfEnd = s1.IndexOf(strend);             string s2 = s1.Substring(0, iIndexOFfEnd);        ...

How to call a page in silverlight:

How to call a page in silverlight:      In silverlight you can use the following code to call a page with in silverlight project.         void buttion_Click( object sender, RoutedEventArgs e)         {             this .Content = new MainPage ();      //here MainPage is page name         }