Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7551345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:28:11+00:00 2026-05-30T10:28:11+00:00

I have a custom built web service that is built to simply add items

  • 0

I have a custom built web service that is built to simply add items into a list in SharePoint Foundation 2010. I have workflow attached to the list but when I create an item using my web service (which references the SharePoint Object Model) workflows ‘Fail on Start’. If I add an item to the list directly within SharePoint the workflows start as required with no problems. I have tried the following so far (including all variations of using them together) but non of these fix the issue:

  • Using SPSecurity.RunWithElevatedPrivilages to run my code
  • Impersonating a different user to the Administrator and System Account to create the item as
  • Running my application pool as the same user as my site’s application pool
  • Running my application pool as a different account to my site’s application pool user
    The web service is not failing and it is creating the items, just the workflows are not running… can anyone help me with this please?

The code I am using to create the list item is as follows:

 SPSecurity.RunWithElevatedPrivileges(delegate()
        {

            SPSite oTempSite = new SPSite(SharePointSite);
            SPUser oUserImpersonate = oTempSite.OpenWeb().EnsureUser(UserToEntryAs);

            SPSite oSite = new SPSite(SharePointSite, oUserImpersonate.UserToken);
            SPWeb oWeb = oSite.OpenWeb();

            try
            {
                oSite.AllowUnsafeUpdates = true;
                oWeb.AllowUnsafeUpdates = true;

                SPList oList = oWeb.Lists["Sample Log"];

                SPListItem oNewItem = oList.Items.Add();

                oNewItem["Customer"] = intCustomerID;
                oNewItem["Cust. Contact Name"] = strCustomerContactName;
                oNewItem["Contact Email"] = strCustomerContactEmail;
                oNewItem["Sample Number"] = strSampleNumber;
                oNewItem["Notes"] = strNotes;
                oNewItem["Application"] = strSampleApplication;
                oNewItem["Despatch Method"] = strDespatchMethod;
                oNewItem["Cost"] = dblCost;
                oNewItem["Sample 1"] = intSampleProductID;
                oNewItem["Weight 1"] = strSampleWeight;
                oNewItem["Batch No. 1"] = strSampleBatch;

                //Handle Account Manager(s):
                SPFieldUserValueCollection usrAccountManagers = new SPFieldUserValueCollection();
                foreach (string strAcctMrg in AccountManagers.Split(';'))
                {
                    SPUser oUser = oWeb.EnsureUser(strAcctMrg);
                    usrAccountManagers.Add(new SPFieldUserValue(oWeb, oUser.ID, oUser.LoginName));
                }
                oNewItem["Account Manager"] = usrAccountManagers;

                oNewItem["Content Type"] = "Ingredient Sample"; //Set the content type to be 'Ingredient Sample'
                oNewItem["Ingredient Sample Status"] = "Awaiting Result"; //Set the status to default to 'Awaiting Result'

                oNewItem.Update();

Thanks in advance…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:28:13+00:00Added an answer on May 30, 2026 at 10:28 am

    After researching the ULS log errors I found the issue was with my web.config file on my Web Service that needed the Authorized types declaring for the workflows to be able to run on the item I had created.

    I used this post to help me resolve it: http://social.msdn.microsoft.com/forums/en-US/sharepointworkflow/thread/71d23c0e-24c5-4d61-8d62-265c374ac81c/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom web service deployed into WSS 3. It has two web
We have a custom-built Flash-based video player that I maintain, and it needs to
I have built a custom membership provider that I have used in a previous
I have a custom application that was built to send opt-in newsletters and marketing
I have a mac with a custom PHP 5 install that built from about
I have a web application that accesses a database through a wcf service. The
I have a fairly substantial library of web services built in .NET that I
I have a Silverlight client that I need to call a web service. The
I'm creating a custom WCF service for deployment inside SharePoint 2010 following the instructions
I have built a custom web part using Visual Studio. Is it possible to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.