Moss: Përditësimi një listë me porosi

Ka shumë shembuj të mirë të përditësimit të listave porosi nëpërmjet SDK. Këtu është ende një.

Problemi Biznes: Forma InfoPath ka qenë i dizajnuar që i mundëson përdoruesve për të hyrë shkresave blerje online. Shkresë PO numrat duhet të jenë të bazuara në vlerat tradicionale rend numër të plotë dhe llogaritet automatikisht.

Zgjidhja e Biznesit: Krijo një listë me porosi Moss përmban dy kolona: "ControlField" and "ControlValue". The value column contains the next purchase requisition number. Note that the generic "control" naming convention provides for future control fields that may be used as needed.

Zgjidhja teknike: Create a web service accessed by the InfoPath client. The web service returns back the next purchase requisition number and updates the value of the list.

Mësimet e mësuara:

  • When adding this web service as a data source to the InfoPath form, I found it necessary to convert it to a udc and store it into a data connection library.
  • I also found it necessary to enable cross domain scripting via central services administration // application management // form server configuration.
  • The first time the form tried to access the web service, it takes a while and on occasion, it would time out. I fiddled with settings in form server configuration to expand the timeout settings and that seemed to help.

Kodi:

përdorim Sistem;
përdorim System.Web;
përdorim System.Web.Services;
përdorim System.Web.Services.Protocols;
përdorim Microsoft.SharePoint;
përdorim System.Configuration;

[Webservice(Namespace = "http://www.conchango.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
publik klasë PoService : System.Web.Services.Webservice
{
publik PoService () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

/// <përmbledhje>
/// Obtain the next PO number from the sharepoint po number control list.
/// Increment the PO number in that list.
/// </përmbledhje>
/// <returns></returns>
[WebMethod]
publik varg GetNextPoNumber()
{
varg SpPoControlSiteName; // Name of the actual MOSS site that hosts the PO Control list.
varg SpPoControlListName; // Name of the actual MOSS list containing the Po control.

SpPoControlSiteName = ConfigurationSettings.AppSettings["PoControlListHostingSite"].ToString();
SpPoControlListName = ConfigurationSettings.AppSettings["PoControlList"].ToString();

varg nextPoReqNumber = "xyzzy";

përdorim (SPSite site = i ri SPSite(SpPoControlSiteName))
{
përdorim (SPWeb web = site.OpenWeb())
{

SPList currentList = web.Lists[SpPoControlListName];

foreach (Pështyj controlItem currentList.Items)
{

nëse (((varg)controlItem["ControlField"]).Është e barabartë me("NextPoNumber"))
{
nextPoReqNumber = (varg)controlItem["ControlValue"];

int int_nextPoReqNumber;
int_nextPoReqNumber = Convert.ToInt32(nextPoReqNumber);

int_nextPoReqNumber ;

controlItem["ControlValue"] = int_nextPoReqNumber;
controlItem.Update();
}

} // Locating, reading and updating the PO number in the list.


} // using spweb web = site.openweb()
} // using spsite site = new spsite("http://localhost/mizuho")

kthehem nextPoReqNumber;

}
}

Një mendonin mbi "Moss: Përditësimi një listë me porosi

  1. KSP wrote:
    Hi Pali,
    We have a similar situation what you are mentioning but the problem is i want to use this web servie on a load balance server.Hence,how to handle concurrency requests in this case or how to make the new request wait and only one request should update the list number till then all other requests should be in que.Please let me know how to achieve this.
    Thanks in advance.

Lini një Përgjigju me KSP wrote: Cancel përgjigje

Adresa juaj e emailit nuk do të publikohet. Fusha e kërkuar janë shënuar *