Error Add Item using DI API 2007  B

Sirs,
     I gettin a error on add a item using a follow code:
                   If m_Item.GetByKey('100') = True Then
                        m_Item.ItemType = ItemTypeEnum.itItems
                        m_Item.ItemsGroupCode = 1
                        m_Item.ItemClass = ItemClassEnum.itcMaterial 
'This line ocorred a error 'oToBP.ItemClass = {"Property 'ItemClass' of 'Item' is invalid"}
                        lErrorCode = m_Item.Update()
                    Else
                        lErrorCode = 1
                    End If
Please,
I'm waiting a urgent response .
Great.
Fábio Nascimento

Fabio,
In 2007 A the ItemsgroupCode start at 100 and not 1.
Perhaps this is your problem.
Christophe

Similar Messages

  • Add attachments using workflow api throwing error

    Hi,
    I am getting the following error when i am trying to add attachments using worklist API.
         Missing class: invokeBPEL.MetaData
         Dependent class: com.evermind.io.ClassLoaderObjectInputStream
         Loader: oc4j:10.1.3
         Code-Source: /D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar
         Configuration: <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar
    This load was initiated at hw_services.root:0.0.0 using the Class.forName() method.
    The missing class is not available from any code-source or loader in the system.
         at oracle.classloader.PolicyClassLoader.handleClassNotFound (PolicyClassLoader.java:2068) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@10469011]
         at oracle.classloader.PolicyClassLoader.internalLoadClass (PolicyClassLoader.java:1679) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@10469011]
         at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1635) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@10469011]
         at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1620) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@10469011]
         at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:319) [jre bootstrap, by jre.bootstrap:1.5.0_06]
         at java.lang.Class.forName0 (Native method) [unknown, by unknown]
         at java.lang.Class.forName (Class.java:242) [jre bootstrap, by jre.bootstrap:1.5.0_06]
         at com.evermind.io.ClassLoaderObjectInputStream.resolveClass (ClassLoaderObjectInputStream.java:33) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at java.io.ObjectInputStream.readNonProxyDesc (ObjectInputStream.java:1538) [jre bootstrap, by jre.bootstrap:1.5.0_06]
         at java.io.ObjectInputStream.readClassDesc (ObjectInputStream.java:1460) [jre bootstrap, by jre.bootstrap:1.5.0_06]
         at java.io.ObjectInputStream.readOrdinaryObject (ObjectInputStream.java:1693) [jre bootstrap, by jre.bootstrap:1.5.0_06]
         at java.io.ObjectInputStream.readObject0 (ObjectInputStream.java:1299) [jre bootstrap, by jre.bootstrap:1.5.0_06]
         at java.io.ObjectInputStream.readObject (ObjectInputStream.java:339) [jre bootstrap, by jre.bootstrap:1.5.0_06]
         at com.evermind.server.rmi.RMIProtocol$Version.unmarshallParameterDirectly (RMIProtocol.java:402) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.RMIProtocol$Version_1_0.unmarshallParameter (RMIProtocol.java:471) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.RMIProtocol.readObject (RMIProtocol.java:80) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.RMIProtocol.readValue (RMIProtocol.java:161) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.ServerRmiMessageHandler.handleMethodInvocation (ServerRmiMessageHandler.java:514) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.ServerRmiMessageHandler.handleOrmiRequest (ServerRmiMessageHandler.java:272) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.ServerRmiMessageHandler.dispatchRequest (ServerRmiMessageHandler.java:241) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.RMIServerConnection.processReceivedCommand (RMIServerConnection.java:176) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.RMIConnection.handleCommand (RMIConnection.java:152) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands (RMIConnection.java:127) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.RMIServerConnection.listenForOrmiCommands (RMIServerConnection.java:390) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.server.rmi.RMIConnection.run (RMIConnection.java:107) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run (ReleasableResourcePooledExecutor.java:303) [D:/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\product\10.1.3.1\OracleAS_1\j2ee\home\oc4j.jar), by oc4j:10.1.3]
         at java.lang.Thread.run (Thread.java:595) [jre bootstrap, by jre.bootstrap:1.5.0_06]
    Exception in thread "main"
    This is the code i used
         String userId = "oc4jadmin";
         String password = "welcome1";
         String sTaskId = "";
         IWorkflowServiceClient wfSvcClient = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT);
         System.out.println("Before getting TaskService");
         ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();
         System.out.println("After getting TaskService");
         IWorkflowContext wfCtx = querySvc.authenticate(userId,password,"jazn.com",null);
         System.out.println("Last out");
         Predicate pred = new Predicate(TableConstants.WFTASK_STATE_COLUMN,Predicate.OP_EQ,IWorkflowConstants.TASK_STATE_ASSIGNED);
         List queryColumns = new ArrayList();
         queryColumns.add("TITLE");
         queryColumns.add("PRIORITY");
         queryColumns.add("STATE");
         queryColumns.add("TASKID");
         queryColumns.add("TASKNUMBER");
         List tasks = querySvc.queryTasks(wfCtx,
                   queryColumns,
                   null, //Do not query addtional info
                   ITaskQueryService.ASSIGNMENT_FILTER_MY_AND_GROUP,
                   null, //No keywords
                   pred, //No custom predicate
                   null, //No special ordering
                   0, //Do not page the query result
                   0);
         System.out.println("Task Size !!" +tasks.size());
         if (tasks != null)
         String[] taskList = new String[tasks.size()];
         for (int i=0; i< tasks.size(); i++)
         Task t = (Task)tasks.get(i);
         taskList[i] = t.getSystemAttributes().getTaskId();
         System.out.println("Found task: "+taskList);
         sTaskId = taskList[i];
         else
         System.out.println("Did not find any tasks");
         Task task = querySvc.getTaskDetailsById(wfCtx, sTaskId);
         //Add Attachments
         FileInputStream fs = new FileInputStream("D:/Test.txt");
         ITaskService itask = wfSvcClient.getTaskService();
         MetaData mdata = new MetaData();
         mdata.setMimeType("text/html");
         mdata.setContent("D:/Test.txt");
         mdata.setInputStream(fs);
         mdata.setName("Test Document");
         itask.addAttachment(wfCtx, sTaskId, mdata);
         if (task != null)
         System.out.println("Completing task: "+task.getTitle());
         wfSvcClient.getTaskService().updateTaskOutcome(wfCtx, task, "APPROVE");
    Kindly let me know how to solve this issue.
    Thanks,
    Gomathi

    hi,
    Actually i have used AttachmentType..MetaData is the class which i created for implementing AttachmentType as it is Interface Class. Here is the code of MetaData class.
    public class MetaData implements AttachmentType,java.io.Serializable{
         public String getBoundary() {
              // TODO Auto-generated method stub
              return null;
         public String getContent() {
              // TODO Auto-generated method stub
              return null;
         public InputStream getInputStream() {
              // TODO Auto-generated method stub
              return null;
         public String getMimeType() {
              // TODO Auto-generated method stub
              return null;
         public String getName() {
              // TODO Auto-generated method stub
              return null;
         public String getSystemVersionFlag() {
              // TODO Auto-generated method stub
              return null;
         public String getTaskId() {
              // TODO Auto-generated method stub
              return null;
         public String getURI() {
              // TODO Auto-generated method stub
              return null;
         public String getUpdatedBy() {
              // TODO Auto-generated method stub
              return null;
         public int getVersion() {
              // TODO Auto-generated method stub
              return 0;
         public void setBoundary(String arg0) {
              // TODO Auto-generated method stub
         public void setContent(String arg0) {
              String cont = null;
              cont = arg0;
         public void setInputStream(InputStream arg0) {
              InputStream sStream = null;
              sStream = arg0;
         public void setMimeType(String arg0) {
              String mime = null;
              mime = arg0;
         public void setName(String arg0) {
              String sname = null;
              sname = arg0;
         public void setSystemVersionFlag(String arg0) {
              // TODO Auto-generated method stub
         public void setTaskId(String arg0) {
              // TODO Auto-generated method stub
         public void setURI(String arg0) {
              // TODO Auto-generated method stub
         public void setUpdatedBy(String arg0) {
              // TODO Auto-generated method stub
         public void setVersion(int arg0) {
              // TODO Auto-generated method stub
    kindly tell me how can i solve this issue.
    Thanks,
    Gomathi
    Edited by: user647559 on Sep 23, 2008 10:05 PM

  • How to update 500 list items using Rest API

    Hi All,
    i have requirement that is "required to update 500 list items using rest Api".
    how can i do it,please share your thoughts with me.
    Thanks,
    Madhu.

    Didn't get you correctly, if you asking reference for REST API to update list items please refer below links
    http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx
    Destin -MCPD: SharePoint Developer 2010, MCTS:SharePoint 2007 Application Development

  • Add Item using REST and populate People field (SharePoint 2010)

    I am trying to add an item to a list that has a People type field using REST API.  For some reason, I am getting 400 (Bad Request) error.  Can anyone show me how to add a list item and populate the user field?
    Here's the code snippet I am using -
    var url = 'https://mytestsite/_vti_bin/listdata.svc/mylist';
    var item = {};
    item.Title = 'my REST item';
    item.User = 'contoso\user1';
    var jsonObj = Sys.Serialization.JavaScriptSerializer.serialize(item);
    $.ajax({
             type: 'POST',
             url: url,
             contentType: 'application/json',
             processData: false,
             data: jsonObj,
             success: function ()
               console.log('item updated');
    Thanks!

    Hi,
    To update the People field, we will need to make a reference to the user information list.
    Here are two links will provide more information:
    http://sharepoint.stackexchange.com/questions/65650/rest-api-update-a-muli-value-user-field
    http://charliedigital.com/2011/04/23/updating-user-fields-via-listdata-svc/
    You can view the User Information list in this way:
    http://zimmergren.net/technical/sharepoints-hidden-user-list-user-information-list
    Best regards
    Patrick Liang
    TechNet Community Support

  • Sharepoint-Hosted App giving FORBIDDEN error when i use REST Api

    Hi,
    I have created a sharepoint hosted app which will create Team site on button click.
    I used REST Api  and  NAPA Tool to develop this app.
    Napa tool gives to things ClientWebpart.aspx and Default.aspx.
    When i run my Default.aspx code is working fine but ClientWebpart.aspx is giving FORBIDDEN error when i am trying to create site.
    Below is the code which i used to create site
    code:
    var hostweburl;
    var appweburl;
    $(document).ready(function () {
    hostweburl= decodeURIComponent(getQueryStringParameter("SPHostUrl"));
    appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
    function createSPWeb() {
    $.ajax(
    url: appweburl +
    "/_api/SP.AppContextSite(@target)/web/webinfos/add?@target='" +
    hostweburl + "'",
    type: "POST",
    data: JSON.stringify(
    'parameters':
    '__metadata': { 'type': 'SP.WebInfoCreationInformation' },
    'Url': 'RestSubWeb',
    'Title': 'RestSubWeb',
    'Description': 'REST created web',
    'Language': 1033,
    'WebTemplate': 'sts#0',
    'UseUniquePermissions': false
    headers: {
    "accept": "application/json;odata=verbose",
    "content-type": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val()
    success: successHandler,
    error: errorHandler
    NOTE:This is on sharepoint online.
    Please help
    Regards,
    sudeep

    So in the app you are testing, are you using the FQDN or the NetBIOS name? Bad practice but could you test with both (hard code the absolute URL for testing purposes) then retest your app?
    If you are making a web part based on the new app model this will be an "app part" and probably have the same issues you are experiencing. If this is for something internal rather than a product you are developing to resell then the script editor /
    content editor web part approach could work for you.
    Paul
    Paul Mather | Twitter |
    http://pwmather.wordpress.com | CPS

  • Create List Item using REST API

    Hi All
      I try create list item using REST in SharePoint 2013.  when code is try add new item in list , getting error :
    A node of type 'EndOfInput' was read from the JSON reader when trying to read the start of an entry. A 'StartObject' node was expected.
    Please help me
    function addData() {
    var title = $('#txtTitile').val();
    //alert(title);
    var items = {
    __metadata: { "Type": "SP.Data.OrderDetailsListItem"},
    Title:title
    var exec = new SP.RequestExecutor(appweburl);
    exec.executeAsync(
    url: appweburl + "/_api/SP.AppContextSite(@target)/web/lists/getbytitle('OrderDetails')/Items?@target='" + hostweburl + "'",
    method: "POST",
    data: JSON.stringify(items),
    headers: {
    Accept: "application/json;odata=verbose",
    "Content-Type": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val()
    success: function (data) { alert(JSON.parse(data)); },
    error: function (error)
    { alert(JSON.stringify(error)); }
    with Regards Sivam

    Hi,                                                             
    Here is a demo which works in my environment for your reference:
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
    $("#Button1").click(function(){
    createListItemWithDetails("list2", "http://sp2013sps", "item1");
    // Getting the item type for the list
    function GetItemTypeForListName(name) {
    //alert("GetItemTypeForListName: "+name);
    return"SP.Data." + name.charAt(0).toUpperCase() + name.slice(1) + "ListItem";
    // CREATE Operation
    // listName: The name of the list you want to get items from
    // siteurl: The url of the site that the list is in. // title: The value of the title field for the new item
    // success: The function to execute if the call is sucesfull
    // failure: The function to execute if the call fails
    function createListItemWithDetails(listName, siteUrl, title) {
    var itemType = GetItemTypeForListName(listName);
    //alert("itemType :"+itemType);
    var item = {
    "__metadata": { "type": itemType },
    "Title": title
    $.ajax({
    url: siteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items",
    type: "POST",
    contentType: "application/json;odata=verbose",
    data: JSON.stringify(item),
    headers: {
    "Accept": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val()
    success: function (data) {
    location.href=location.href;
    //success(data);
    error: function (data) {
    alert("error");
    //failure(data);
    </script>
    <input id="Button1" type="button" value="Run Code"/>
    Best regards
    Patrick Liang
    TechNet Community Support

  • Add item using BAPI_OPPORTUNITY_CHANGEMULTI.

    hi,
    i want to add line item using BAPI - 'BAPI_OPPORTUNITY_CHANGEMULTI' . i have created opportunity using bapi 'CRM_WAP_OPP_CREATE' .
    i dont know wat to add in input field table of bapi 'BAPI_OPPORTUNITY_CHANGEMULTI'.
    example i have created opportunity its opportunity id is 1206226
    guid - 5330467C091405C1E1000000C0A80046
    process_type is ZTEN.
    thanks.

    Hi Amisha,
    Please refer to function module CRM_WAP_OPP_SAVE for the sample code.
    Thanks,
    Faisal

  • Error adding file type item using portal api

    We are using portal 3.0.8.
    I can add text and url type items fine but when i try to add a file type item, i get following error.
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.SecurityException: relative
    pathnames are not allowed(c:/abc.txt)
    ORA-06512: at "PORTAL30.WWSBR_API", line 24
    ORA-06512: at "PORTAL30.WWSBR_API", line 272
    ORA-06512: at line 4
    Please help.
    Thanks
    null

    Manoj,
    Please try to define a reproducible test case. Is this happening in all content area? Is it happening with all files, or only particular ones? What platform are you running on? What version of the database are you using?
    Have you checked your repository for invalid objects? If any exist, please try to recompile them.
    Thanks,
    Jerry

  • Add CodeBar to an Item using DI API (Add-On)

    Hi you all.
    I am developing a ADD -On for version 9 and I am having a problem to add the barcode of a item.
    In this new version the barcode must already be created on the table obcd BEFORE assign it to an item, as opposed to 8 in which this was a text field and you could put anything you wanted .
    My problem is that I have a method in my add-on that is responsible for generating an automatic bar code when the user creates a new item, but I can not directly assign this barcode to the item as before ( Item.BarCode = XXXXX ) as I explained previously . Also, if I do it this way a new window pops up to define barcodes and is not what I want.
    I've checked the SDK and mention two objects: SAPbobsCOM.BarCodesService and SAPbobsCOM.BarCode .
    The problem is that when I try to instantiate them, an error come up .
                                    Dim As New SAPbobsCOM.BarCodesService BarCodeService
                                    BarCode Dim As New SAPbobsCOM.BarCode
                                    BarCode.ItemNo = Code
                                    BarCode.BarCode = Generar_Codigo_Barras (Code)
                                    BarCodeService.Add ( BarCode )
    Someone have idea why this is happenning?
    I have also seen that there is a class called SAPbobsCOM.ItemsBarCodes but I can not not instantiate eather
    Thanks in advance
    Greetings.

    Try this:
    * Crea o actualiza un código de barras para un artículo en el formato correspondiente
    void LOG_Util::creaActualizaEANSBO(const string &asItemCode, const string &asEAN, const string &asForm, const string &asDForm)
        SAPbobsCOM::ICompanyServicePtr lpCmpSer;
        SAPbobsCOM::IBarCodesServicePtr lpBCSer;
        SAPbobsCOM::IBarCodeParamsPtr lpBCPar;
        SAPbobsCOM::IBarCodePtr lpBC;
        SAPbobsCOM::IRecordsetPtr lRS;
        ostringstream sql;
        long lUomEntry, lBcdEntry;
        lRS = g->GetCmp()->GetBusinessObject(SAPbobsCOM::BoRecordset);
        lUomEntry = dameUomEntry(asForm);
        // Verificamos la existencia del EAN en la ficha del artículo de SBO
        sql << "SELECT BcdEntry";
        sql << " FROM OBCD";
        sql << " WHERE ItemCode = '" << asItemCode << "'";
        sql <<    " And Bcdcode = '" << asEAN << "'";
        lRS->DoQuery(sql.str().c_str());
        lpCmpSer = g->GetCmp()->GetCompanyService();
        lpBCSer = lpCmpSer->GetBusinessService(SAPbobsCOM::BarCodesService);
        if (lRS->GetEoF() == VARIANT_TRUE)
            // Tenemos que crear el EAN
            lpBC = lpBCSer->GetDataInterface(SAPbobsCOM::bsBarCode);
            lpBC->PutItemNo(asItemCode.c_str());
            lpBC->PutUoMEntry(lUomEntry);
            lpBC->PutBarCode(asEAN.c_str());
            lpBC->PutFreeText(asDForm.c_str());
            lpBCSer->Add(lpBC);
            lpBC.Release();
        else
            // Tenemos que actualizar el EAN
            lBcdEntry = lRS->GetFields()->Item("BcdEntry")->GetValue();
            lpBCPar = lpBCSer->GetDataInterface(SAPbobsCOM::bsBarCodeParams);
            lpBCPar->PutAbsEntry(lBcdEntry);
            lpBC = lpBCSer->Get(lpBCPar);
            lpBC->PutUoMEntry(lUomEntry);
            lpBC->PutFreeText(asDForm.c_str());
            lpBCSer->Update(lpBC);
            lpBC.Release();
            lpBCPar.Release();
        lpBCSer.Release();
        lRS.Release();

  • Update List Items using REST API - Keep Getting 400 Bad Request

    I am using code from the following answer:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/40833576-5853-4ca4-95cf-b5b1d69f465f/sharepoint-rest-and-c-sample-to-update-list-item?forum=sharepointdevelopment
    I am having a tough time figuring out the issue though.  I have been able to retrieve list items, but now I want to update those items.  This is the following code just to get the digest information with passing in credentials:
    public static string GetFormDigest(System.Net.NetworkCredential cred)
    string formDigest = null;
    string resourceUrl = "https://SITEURL/_api/contextinfo";
    HttpWebRequest wreq = HttpWebRequest.Create(resourceUrl) as HttpWebRequest;
    wreq.Credentials = cred;
    wreq.Method = "POST";
    wreq.Accept = "application/json;odata=verbose";
    wreq.ContentLength = 0;
    wreq.ContentType = "application/json";
    string result;
    WebResponse wresp = wreq.GetResponse();
    using (StreamReader sr = new StreamReader(wresp.GetResponseStream()))
    result = sr.ReadToEnd();
    var jss = new JavaScriptSerializer();
    var val = jss.Deserialize<Dictionary<string, object>>(result);
    var d = val["d"] as Dictionary<string, object>;
    var wi = d["GetContextWebInformation"] as Dictionary<string, object>;
    formDigest = wi["FormDigestValue"].ToString();
    Console.WriteLine(formDigest);
    return formDigest;
    Then the following code is used:
    string result = string.Empty;
    Uri uri = new Uri(sharepointUrl.ToString() + "/_api/Web/lists/getByTitle('DemoList')/items(1)");
    HttpWebRequest wreq = (HttpWebRequest)WebRequest.Create(uri);
    wreq.Credentials = cred;
    wreq.Method = "POST";
    wreq.Accept = "application/json; odata=verbose";
    wreq.ContentType = "application/json; odata=verbose";
    wreq.Headers.Add( "X-HTTP-Method","MERGE");
    wreq.Headers.Add( "IF-MATCH", "*");
    wreq.Headers.Add("X-RequestDigest", GetFormDigest(cred));
    string stringData = "{'__metadata': { 'type': 'SP.Data.DemoListListItem' }, 'Title': 'updated!'}";
    wreq.ContentLength = stringData.Length;
    StreamWriter writer = new StreamWriter(wreq.GetRequestStream());
    writer.Write(stringData);
    writer.Flush();
    try {
    WebResponse wresp2 = wreq.GetResponse();
    using (StreamReader sr = new StreamReader(wresp2.GetResponseStream()))
    result = sr.ReadToEnd();
    catch (Exception e) { Console.WriteLine("An error occurred: '{0}'", e); }
    It errors out when it tries to send the command to Sharepoint.  I am NOT using a sharepoint hosted app.  I just wanted to directly contact sharepoint and update items.  Any help or suggestions would be greatly appreciated!
    Thanks,
    Priyank
     

    I just found some other code that seemed to work on editing a title and edited it kind of guessing it would work and it did!
    This is the code that ended working using the same digest code from above:
    Console.WriteLine("\n Newer Fancier Code \n");
    Uri uri = new Uri("https://SHAREPOINTURL/_api/web/lists/GetByTitle('Demo')/items(1)");
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
    request.ContentType = "application/json;odata=verbose";
    request.Headers["X-RequestDigest"] = GetFormDigest(cred);
    request.Headers["X-HTTP-Method"] = "MERGE";
    request.Headers["IF-MATCH"] = "*";
    request.Credentials = cred;
    request.Accept = "application/json;odata=verbose";
    request.Method = "POST";
    string stringData = "{ '__metadata': { 'type': 'SP.ListItem' }, 'Location': 'updatedinfo' }";
    request.ContentLength = stringData.Length;
    StreamWriter writer = new StreamWriter(request.GetRequestStream());
    writer.Write(stringData);
    writer.Flush();
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    StreamReader reader = new StreamReader(response.GetResponseStream());
    Just fyi if anyone was wondering.  Next, I'm going to be trying to update multiple fields, possibly multiple items if possible if anyone knows how to do that.

  • Error with TaskSearchFilter using Java APIs in custom component

    I have created a custom Java component for use in LC Process Mgr.
    Upon invoke of process containing component, component fails with the following message:
    2011-02-28 16:28:31,260 ERROR [com.adobe.workflow.AWS] Cannot coerce object: [email protected]41 of type: com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter to type: class com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter
    Code is pretty basic:
            ServiceClientFactory myFactory = ServiceClientFactory.createInstance();
            TaskManagerQueryService queryManager = TaskManagerClientFactory.getQueryManager(myFactory);
            TaskSearchFilter filter = new TaskSearchFilter();
            filter.addCondition(TaskSearchingConstants.pSTATUS, Operator.EQUALS, "3");
            List<TaskRow> result = queryManager.taskSearch(filter);
    Error seems to occur with the creation of the List. This code works ok when run as standalone file in either Eclipse or Netbeans but not within the component.
    All necessary JARs are included and are listed in the class-path in component.xml.
    Does anyone have any ideas?
    Thanks,
    David

    Looks like a class loader issue.  Usually this is caused by having the a class (TaskSearchFilte) in your component that on the server.   In other words there are two copies of the TaskSearchFilte class - yours and the one already in LiveCycle - and they are in conflict.
    If that's the case, the solution is simple:
    remove the jar files containing the TaskSearchFilte (and any other LiveCycle clients) from your component's jar file.  You may need them in the build path, so your code can compile - but you don't need them in the final component jar.
    remove the references to these jar files from the component.xml file's class-path entry
    add an import-packages section to your component.xml file.  This will not reference the jar files, but the package names themselves.  For example:
    <import-packages>    
         <package version="1.0">com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter</package>
         <!--  add more as needed -->
    </import-packages>

  • Error -- Java code using OIM API to find no of users in OIM

    Hi Experts,
    I hav a requirement that I need to query OIM to find out the total no of active users in the system using a stand alone java program to determine some other process. So I have developed a simple java code but it fails in the below line
    rset=userIntf.findAllUsers(map);  -- It throws null pointer exception
    I have tried with deleteUser() instead of findUsers() , still it throws the null pointer exception on the same line.I have checked the other posts in the forum but could not find out where is the mistake. Can u please suggest me??
    Here is the code
    System.setProperty("XL.HomeDir","D:/bea-oim/xellerate");
    System.setProperty("java.security.auth.login.config","D:/bea-oim/xellerate/config/authwl.conf");
    System.setProperty("java.security.policy","D:/bea-oim/xellerate/config/xl.policy");
    System.setProperty("log4j.configuration","D:/bea-oim/xellerate/config/log.properties");
    tcUtilityFactory utilityFactory = null;
    tcUserOperationsIntf userIntf = null;
              try
                   tcResultSet rset;
                   ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
                   final Hashtable env = config.getAllSettings();
                   tcSignatureMessage moSignature = tcCryptoUtil.sign("xelsysadm","PrivateKey");
                   utilityFactory = new tcUtilityFactory(env, moSignature);
                   userIntf=(tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
                   HashMap map = new HashMap();
                   map.put("Users.Status","Active");
                   rset=userIntf.findAllUsers(map);
    System.out.println(rset.getRowCount());
         catch(NullPointerException ne)
         System.out.println(ne.getMessage());
         ne.printStackTrace();
         catch(Exception e)
         System.err.println(e.getMessage());
         e.printStackTrace();
    Thanks & Regards
    INIYA

    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.util.HashMap;
    import java.util.Properties;
    import java.util.*;
    import Thor.API.tcUtilityFactory;
    import Thor.API.Operations.*;
    import Thor.API.tcResultSet;
    import com.thortech.xl.crypto.tcCryptoUtil;
    import com.thortech.xl.util.config.ConfigurationClient;
    * @author Rajiv
    public class CreateBulkUsers {
    public static void main(String args[])
    System.setProperty("XL.HomeDir", "E:\\oim\\server\\xellerate");
    System.setProperty("java.security.auth.login.config", "E:\\oim\\server\\xellerate\\config\\auth.conf");
    System.setProperty("java.security.policy", "E:\\oim\\server\\xellerate\\config\\xl.policy");
              tcUtilityFactory utilityFactory = null;
    tcUserOperationsIntf userIntf = null;
    try
    com.thortech.xl.util.config.ConfigurationClient.ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
    java.util.Hashtable env = config.getAllSettings();
    com.thortech.xl.crypto.tcSignatureMessage moSignature = tcCryptoUtil.sign("xelsysadm", "PrivateKey");
    utilityFactory = new tcUtilityFactory(env, moSignature);
    // System.out.println((new StringBuilder()).append("utilityFactory = ").append(utilityFactory).toString());
    userIntf = (tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
    HashMap map = new HashMap();
    map.put("Users.Status", "Active");
    tcResultSet rset = userIntf.findAllUsers(map);
    System.out.println(rset.getRowCount());
    catch(NullPointerException ne)
    System.out.println(ne.getMessage());
    ne.printStackTrace();
    catch(Exception e)
    System.err.println(e.getMessage());
    e.printStackTrace();
    Include all the JARs to run this class from outside not only of OIm of JBoss or Weblogic also.
    eg: jboss\client and jboss\lib

  • Error using DI API on Item Revaluation

    Dear All
    While on Revaluation of Item using DI API System gives error meaasage as "Internal Error 5002" ans displaya 'Material Revaluation failed'.
    Can any one help me to find the reason for this error and how to overcome the situation?
    With regards
    Aloke

    Dear Siva
    Following is the code I am using for revaluation of items which is giveing "Internal Error 5002':
    Dim lMaterialRevaluation As SAPbobsCOM.MaterialRevaluation
            lMaterialRevaluation = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oMaterialRevaluation)
            For li As Integer = 0 To ls_Lines.Length - 1
                If ls_Lines(li).Split(vbTab).Length <> 5 Then
                    My.Computer.FileSystem.WriteAllText(ls_OutFileName, lnl_SrlNo & "--> Can't Read in the data in Line " & li + 1, True)
                    My.Computer.FileSystem.WriteAllText(ls_OutFileName, vbNewLine, True)
                    lnl_SrlNo += 1
                    Continue For
                End If
                ls_ItemCode = ls_Lines(li).Split(vbTab)(0).Trim
                ls_WareHouseCode = ls_Lines(li).Split(vbTab)(1).Trim
                ld_Price = ls_Lines(li).Split(vbTab)(2).Trim
                li_IncAccount = ls_Lines(li).Split(vbTab)(3).Trim
                li_DecAccount = ls_Lines(li).Split(vbTab)(4).Trim
                lMaterialRevaluation.Lines.SetCurrentLine(li)
                lMaterialRevaluation.Lines.ItemCode = ls_ItemCode
                lMaterialRevaluation.Lines.WarehouseCode = ls_WareHouseCode
                lMaterialRevaluation.Lines.Price = ld_Price
                lMaterialRevaluation.Lines.RevaluationIncrementAccount = li_IncAccount
                lMaterialRevaluation.Lines.RevaluationDecrementAccount = li_DecAccount
                lMaterialRevaluation.Lines.Add()
            Next
            Dim li_Ret As Integer
            li_Ret = lMaterialRevaluation.Add
            If li_Ret = 0 Then
                MsgBox("Material Revaluation Completed")
                System.Runtime.InteropServices.Marshal.ReleaseComObject(lMaterialRevaluation)
            Else
                oCompany.GetLastError(lErrCode, sErrMsg)
                MsgBox(sErrMsg & ", Material Revaluation failed")
            End If
    Can you or any one else suggest where the error lies.
    Thanks & with regards
    Aloke
    Edited by: ALOKE BANDYOPADHYAY on Jul 5, 2011 3:01 PM

  • Use UWL API in a Servet and access the servlet via URL

    Hi All,
    Actually I want to write a servlet from which I will access the uwl items using UWL APIs. And then I will submit HTTP Request to this servlet via url and want to get the UWL items in response. Is it Possible. I know that it is possible to access uwl items from JSPDynpage but is it possible to use it via servlet. If possible please give me some idea. what are the prerequisite.
    Thanks and Regards
    Avijit

    Hello,
    I see your thread is still unanswered, were you able to resolve the problem yourself (if so can you share with others who may have the same problem)? If so can you add anymore details which may help someone else to find an answer?  Or is it ok to mark this post as assumed answered?
    Beth Maben
    EP - Senior Support Consultant II
    SAP Active Global Support
    Global Support Centre Ireland
    **SDN Forum Moderator:
    SAP Enterprise Portal: Application Integration
    **SDN Universal Worklist Wiki:
    http://wiki.sdn.sap.com/wiki/x/ehU

  • Goods Recept  entry using DI API

    Hi,
    I would like to know if it is possible to enter Goods Receipt (for batch managed item) using DI API:
    Has anybody done it? Do you have any idea about how to do it?
    Thanks

    Hi, Gabriel!
    I use the 2004C B1 SDK. It's DI doesn't have a Goods Receipt and Goods Issue objects. The only work around i had was to fill these forms using UI.
    Regards,
    Alexey

Maybe you are looking for