none
DeleteWebObject deletes not only links but also other objects associated with links RRS feed

  • General discussion

  • Interesting. I wonder what is API which uses MS Project, because from it evth wotks fine. Guys from MCSFT know the answer?
    Bartosz
    Wednesday, November 16, 2011 4:39 PM

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
    Thursday, November 17, 2011 8:32 AM