MOSS: Абнаўленне карыстацкага спісу

Ёсць шмат добрых прыкладаў абнаўлення карыстацкіх спісаў з дапамогай SDK. Гэта яшчэ адзін.

Бізнес-задачы: InfoPath форма была распрацавана, што дазваляе карыстальнікам ўводзіць онлайн заявак на закупкі. PO нумары Заяўкі павінны быць традыцыйнымі на аснове паслядоўнасці цэлых значэнняў і разлічваецца аўтаматычна.

Business Solution: Стварэнне наладжвальнага спісу MOSS двума слупкамі: "ControlField" and "ControlValue". Значэнне слупок ўтрымлівае нумар наступнага рэквізіцыі куплі. Note that the generic "control" наймення падае для будучага поля кіравання, які можа быць выкарыстаны пры неабходнасці.

Тэхнічнае рашэнне: Стварэнне вэб-службы доступ кліента InfoPath. Вэб-служба вяртае назад Наступны нумар рэквізіцыі пакупкі і абнаўляе значэнне спісу.

Урокі:

  • Пры даданні гэтага вэб-сэрвісу ў якасці крыніцы дадзеных для формаў InfoPath, Я палічыў неабходным пераўтварыць яго ў УДК і захоўваць яго ў бібліятэцы падлучэнняў да дадзеных.
  • 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.

Код:

выкарыстанне Сістэма;
выкарыстанне System.Web;
выкарыстанне System.Web.Services;
выкарыстанне System.Web.Services.Protocols;
выкарыстанне Microsoft.SharePoint;
выкарыстанне System.Configuration;

[WebService(Namespace = "http://www.conchango.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
грамадскасць клас PoService : System.Web.Services.WebService
{
грамадскасць PoService () {

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

/// <рэзюмэ>
/// Obtain the next PO number from the sharepoint po number control list.
/// Increment the PO number in that list.
/// </рэзюмэ>
/// <returns></returns>
[WebMethod]
грамадскасць радок GetNextPoNumber()
{
радок SpPoControlSiteName; // Name of the actual MOSS site that hosts the PO Control list.
радок SpPoControlListName; // Name of the actual MOSS list containing the Po control.

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

радок nextPoReqNumber = "XYZZY";

выкарыстанне (SPSite site = новы SPSite(SpPoControlSiteName))
{
выкарыстанне (SPWeb web = site.OpenWeb())
{

SPList currentList = web.Lists[SpPoControlListName];

Еогеасп (Пляваць controlItem ў currentList.Items)
{

калі (((радок)controlItem["ControlField"]).Роўна("NextPoNumber"))
{
nextPoReqNumber = (радок)controlItem["ControlValue"];

Int int_nextPoReqNumber;
int_nextPoReqNumber = Канвертаваць.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")

вяртанне nextPoReqNumber;

}
}

Адна думка пра «MOSS: Абнаўленне карыстацкага спісу

  1. KSP wrote:
    Прывітанне Павел,
    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.
    Дзякуй загадзя.

Пакінуць каментар да KSP wrote: адмяніць адказ

Ваш электронны адрас не будзе апублікаваны. Абавязковыя палі пазначаныя * *