SharePoint Lookup Field Multiple Values Via C#

In this article, we will explain How to programmatically

  • Set a SharePoint Lookup Field (Single Value) via SSOM C#.
  • Set a SharePoint Lookup Field (Multiple Values) via SSOM C#.
  • Get a SharePoint SharePoint Lookup Field (Single Value) via SSOM C#.
  • Get a SharePoint SharePoint Lookup Field (Multiple Values) via SSOM C#.

 Continue reading “SharePoint Lookup Field Multiple Values Via C#”

Advertisements

Get and Set a SharePoint Multiple Lookup Field Value Using Server Object Model C#

At this hint, I explains How to Get and Set a SharePoint Multiple Lookup Field value using Server Object Model C#

To set a SharePoint Multiple Lookup Field value Continue reading “Get and Set a SharePoint Multiple Lookup Field Value Using Server Object Model C#”

Get and Set a SharePoint Lookup Field Value Using Server Object Model C#

At this hint, I will explain

How to Get and Set a SharePoint Lookup Field (Single Value) using Server Object Model C#

Set a SharePoint Lookup Field value Continue reading “Get and Set a SharePoint Lookup Field Value Using Server Object Model C#”

Retrieve a SharePoint Choice Field Value Using Server Object Model C#

In this hint, I will explain How to

Retrieve a SharePoint Choice Field Value using C# Server Object Model.


Steps:

  • Open your SharePoint Solution.
  • Add the following bind() function in your code.
  • Call bind() function in Load with no postback.

Retrieve SharePoint Choice Field Value to a drop-down list using C#

private void bind()
   {
      SPWeb site = SPContext.Current.Web;
      SPList list = site.Lists["ListName"];
      SPFieldChoice myChoicesfield = (SPFieldChoice)list.Fields["FieldName"];
        for (int i = 0; i < myChoicesfield.Choices.Count; i++)
          {
            DropDownListName.Items.Add(myChoicesfield.Choices[i].ToString());
          }
   }

Retrieve SharePoint Choice Field Value to a checkbox list using C#


  private void bind()
     {
         SPWeb site = SPContext.Current.Web;
         SPList list = site.Lists["ListName"];
         SPFieldMultiChoice choices = (SPFieldMultiChoice)list.Fields[FieldName];
          foreach (string str in choices.Choices)
            {
                cblCheckboxList.Items.Add(new ListItem(str, str));
            }
      }

See also

Get and Set a SharePoint URL Field Value Using Server Object Model C#

At this hint, I explains How to Get and Set a SharePoint URL Field value using Server Object Model C#

To set a SharePoint URL Field value Continue reading “Get and Set a SharePoint URL Field Value Using Server Object Model C#”

Get and Set a SharePoint Multiple Choice Field Value Using Server Object Model C#

At this hint, I explains How to Get and Set a SharePoint Multiple Choice Field value using Server Object Model C#

To set a SharePoint Multiple Choice Field value Continue reading “Get and Set a SharePoint Multiple Choice Field Value Using Server Object Model C#”

Get and Set a SharePoint User Field Value Using Server Object Model C#

At this hint, I explains How to Get and Set a SharePoint User Field value using Server Object Model C#

To set a SharePoint User Field value Continue reading “Get and Set a SharePoint User Field Value Using Server Object Model C#”