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

  • SEARCH
  • Home
  • 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 8203979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:44:47+00:00 2026-06-07T07:44:47+00:00

I am trying to create a method to publish and finish the workflow activity

  • 0

I am trying to create a method to publish and finish the workflow activity using core service. am getting the compile error. Below is my code. Can any one correct me? Its an urgent.

public void PublishComponent(string WorkItemId)
    {
        var client = new SessionAwareCoreServiceClient();
        var readoptions = new ReadOptions();            
        ComponentData component = (ComponentData)client.Read(new TcmUri(WorkItemId), readoptions) as ComponentData;
        List<IdentifiableObjectData> ItemToPublish = new List<IdentifiableObjectData>();            
        ItemToPublish.Add(component);
        PublishInstructionData instruction = new PublishInstructionData();
        PublicationTargetData pubtarget = (PublicationTargetData)client.Read(new TcmUri("tcm: 0 - 21 - 65537"), readoptions) as PublicationTargetData;
        List<PublicationTargetData> target = new List<PublicationTargetData>();
        target.Add(pubtarget);            
        client.Publish(ItemToPublish, instruction, target, PublishPriority.Normal, readoptions);


        WorkItemData workitem = new WorkItemData();
        workitem.Id = new TcmUri(WorkItemId);            
        ActivityInstanceData currentactivity = new ActivityInstanceData();
        ActivityFinishData finish = new ActivityFinishData();
        finish.Message="Published";
        client.FinishActivity(currentactivity, finish, readoptions);
}
  • 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-06-07T07:44:48+00:00Added an answer on June 7, 2026 at 7:44 am

    There were several problems, but the main is that there’s no TcmUri class, like in TOM.NET, it’s string in CoreService. And the same for Publish method, it takes string arrays as input, not item arrays, like in TOM.NET

            var client = new SessionAwareCoreServiceClient();
            var readoptions = new ReadOptions();
            ComponentData component = (ComponentData)client.Read(WorkItemId, readoptions);
            List<string> ItemToPublish = new List<string>();
            ItemToPublish.Add(component.Id);
            PublishInstructionData instruction = new PublishInstructionData();
            PublicationTargetData pubtarget = (PublicationTargetData)client.Read("tcm:0-21-65537", readoptions);
            List<string> target = new List<string>();
            target.Add(pubtarget.Id);
            client.Publish(ItemToPublish.ToArray(), instruction, target.ToArray(), PublishPriority.Normal, readoptions);
    
    
            WorkItemData workitem = new WorkItemData();
            workitem.Id = WorkItemId;
            ActivityInstanceData currentactivity = new ActivityInstanceData();
            ActivityFinishData finish = new ActivityFinishData();
            finish.Message = "Published";
            client.FinishActivity(currentactivity.Id, finish, readoptions);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create Guava TreeMultimap object in scala, using TreeMultimap.create method, but
I'm trying to create a method using an expression tree that returns an object,
I am working on an ASMX web service; trying to create a method that
I'm trying to create method to append buffers. Here's code, which takes very strange
Im trying to create a method that take 2 int array as the input
I'm trying to create a method that will sum two timeO objects and return
I am trying to create a method that accepts multiple types of controls -
I'm trying to create a method that will allow me to set properties within
I have a winforms application and I am trying to create a method that
I am trying to create a search method to attach files on my outbound

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.