none
DeleteWebObjectLink deletes WebObjects. RRS feed

  • Question

  • Behaviour in spite of documentation. Do You know the solution? In the consequence deliverables disppear from MS Project.
    Bartosz
    Wednesday, November 16, 2011 3:53 PM

Answers

  • OK, here we are,

     

    Because original functions from WebSvcObjectLinkProvider do more than one expects of them, and guys from Microsoft keep quiet, I made a bypass. Ugly, but efficient.

     

    What is the case study which stand behind all this browl? Below is the description:

    -          I have a project in Procejc Server, in which is one task and one deliverable. I link them in MS Project 2010, and try to break the link by c# code.  This based on original functions didn’t work.

    Function looks as follow:

            /*

            Function: iDetachDeliverableFromTask

            version: 1.0.3

            function breaks link between task and deliverable. Function connects to Project Server 'Published' database and sets appropriate

            attributes in the tables.

            parameters:

                poProjectGuid: concerned project Guid

                poTaskGuid: concerned task Guid

                piDeliverableID: ID of item in Deliverables list

                poList: Deliverable's list Guid

             "Data Source=localhost;Initial Catalog=ProjectServer_Published;Integrated Security=True"

             */

            public int iDetachDeliverableFromTask(Guid poProjectGuid, Guid poTaskGuid, int piDeliverableID, Guid poList)

            {

                try

                {

                    using (SqlConnection connection = new SqlConnection(sSQL_PR_DB))

                    {

                        connection.Open();

     

                        SqlCommand loCommand = new SqlCommand();

                        loCommand.Connection = connection;

                        loCommand.CommandText = "UPDATE WO1 set WOBJ_TYPE = 1, WOBJ_TASK_UID='00000000-0000-0000-0000-000000000000' from [ProjectServer_Published].[dbo].[MSP_WEB_OBJECTS] INNER JOIN [ProjectServer_Published].[dbo].[MSP_WEB_OBJECT_LINKS] ON [ProjectServer_Published].[dbo].[MSP_WEB_OBJECT_LINKS].WOBJLINK_OBJECT1 = [ProjectServer_Published].[dbo].[MSP_WEB_OBJECTS].WOBJ_UID INNER JOIN [ProjectServer_Published].[dbo].[MSP_WEB_OBJECTS] AS WO1 ON [ProjectServer_Published].[dbo].[MSP_WEB_OBJECT_LINKS].WOBJLINK_OBJECT2 = WO1.WOBJ_UID WHERE [ProjectServer_Published].[dbo].[MSP_WEB_OBJECTS].WOBJ_TP_ID=" + piDeliverableID.ToString() + " AND [ProjectServer_Published].[dbo].[MSP_WEB_OBJECTS].WOBJ_LIST_NAME = '" + poList.ToString() + "' AND WO1.WOBJ_TASK_UID = '" + poTaskGuid.ToString() + "' AND WO1.WOBJ_TYPE = 2 ";

                        int liVar = loCommand.ExecuteNonQuery();

                        return 0;

                    }

                }

                catch (Exception ex)

                {

                    sErrorText = ex.Message;

                    return -1;

                }

            }

     

     

    I checked WebSvcObjectLinkProvider in 2 environments with the newest patches, so in my opinion this problem is actual.

    If You know different solution, I would be grateful for info: dimmi5@interia.pl.


    Bartosz
    • Marked as answer by DIMMI5 Thursday, November 17, 2011 8:34 AM
    Thursday, November 17, 2011 8:33 AM

All replies

  • OK, here we are,

     

    Because original functions from WebSvcObjectLinkProvider do more than one expects of them, and guys from Microsoft keep quiet, I made a bypass. Ugly, but efficient.

     

    What is the case study which stand behind all this browl? Below is the description:

    -          I have a project in Procejc Server, in which is one task and one deliverable. I link them in MS Project 2010, and try to break the link by c# code.  This based on original functions didn’t work.

    Function looks as follow:

            /*

            Function: iDetachDeliverableFromTask

            version: 1.0.3

            function breaks link between task and deliverable. Function connects to Project Server 'Published' database and sets appropriate

            attributes in the tables.

            parameters:

                poProjectGuid: concerned project Guid

                poTaskGuid: concerned task Guid

                piDeliverableID: ID of item in Deliverables list

                poList: Deliverable's list Guid

             "Data Source=localhost;Initial Catalog=ProjectServer_Published;Integrated Security=True"

             */

            public int iDetachDeliverableFromTask(Guid poProjectGuid, Guid poTaskGuid, int piDeliverableID, Guid poList)

            {

                try

                {

                    using (SqlConnection connection = new SqlConnection(sSQL_PR_DB))

                    {

                        connection.Open();

     

                        SqlCommand loCommand = new SqlCommand();

                        loCommand.Connection = connection;

                        loCommand.CommandText = "UPDATE WO1 set WOBJ_TYPE = 1, WOBJ_TASK_UID='00000000-0000-0000-0000-000000000000' from [ProjectServer_Published].[dbo].[MSP_WEB_OBJECTS] INNER JOIN [ProjectServer_Published].[dbo].[MSP_WEB_OBJECT_LINKS] ON [ProjectServer_Published].[dbo].[MSP_WEB_OBJECT_LINKS].WOBJLINK_OBJECT1 = [ProjectServer_Published].[dbo].[MSP_WEB_OBJECTS].WOBJ_UID INNER JOIN [ProjectServer_Published].[dbo].[MSP_WEB_OBJECTS] AS WO1 ON [ProjectServer_Published].[dbo].[MSP_WEB_OBJECT_LINKS].WOBJLINK_OBJECT2 = WO1.WOBJ_UID WHERE [ProjectServer_Published].[dbo].[MSP_WEB_OBJECTS].WOBJ_TP_ID=" + piDeliverableID.ToString() + " AND [ProjectServer_Published].[dbo].[MSP_WEB_OBJECTS].WOBJ_LIST_NAME = '" + poList.ToString() + "' AND WO1.WOBJ_TASK_UID = '" + poTaskGuid.ToString() + "' AND WO1.WOBJ_TYPE = 2 ";

                        int liVar = loCommand.ExecuteNonQuery();

                        return 0;

                    }

                }

                catch (Exception ex)

                {

                    sErrorText = ex.Message;

                    return -1;

                }

            }

     

     

    I checked WebSvcObjectLinkProvider in 2 environments with the newest patches, so in my opinion this problem is actual.

    If You know different solution, I would be grateful for info: dimmi5@interia.pl.


    Bartosz
    • Marked as answer by DIMMI5 Thursday, November 17, 2011 8:34 AM
    Thursday, November 17, 2011 8:33 AM
  • Hi there,

    It seems to be working for you now. At this point, I don't have any option but I have 2 cents to give you heads up.


    I see that this code is executing a SQL query which is updating the project server 2010 published database. This may break your project server in future updates (SP, CU or any hot fix). A direct database update using SQL query is not supported in case if this breaks any functionality.

    http://technet.microsoft.com/en-us/library/ff686786.aspx

    Only the Reporting database schema is documented. You should access the Draft, Published, and Archive databases only through the PSI. You can add data tables, fields (properties), and entities that are not defined in the Project Server 2010 database schema to the Reporting database. If you add tables to the core databases, you must also provide the full stack of a custom assembly, Web service, business objects, and data access. You can easily modify the Reporting database; we recommend that you do not modify the core Project Server databases.


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82
    Thursday, November 17, 2011 9:00 AM
  • Amit;

    i have 2 options:

       - to have any solution

       - not to have any solution.

    Functions from WebSVCOLP blow arrays up, my solution not. If You can give me an alternative, You have my full support :)

    Regards

    bp

     

     


    Bartosz
    Thursday, November 17, 2011 9:18 AM
  • A VBA code might be interesting:
    http://blogs.msdn.com/b/project_programmability/archive/2007/02/19/working-with-deliverables.aspx

    Project.DeliverablesClearAll
    http://msdn.microsoft.com/en-us/library/ff860518.aspx

    For deletion
    http://msdn.microsoft.com/en-us/library/ff864109.aspx
    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82
    Thursday, November 17, 2011 9:33 AM
  • Hi;

     

    VBA from Web Service?That might be a challenge :)

    I don't want to delete deliverable, but weblink or webobject. If i delete a deliverable it breaks the links with another tasks.

    Let me stay by my solution :)

    Regards

    bp

     


    Bartosz
    Thursday, November 17, 2011 10:54 AM