Community
Showing results for 
Search instead for 
Do you mean 
Reply

Calendar Accessors

Nickel Super Contributor
Posts: 441
Country: UK

Calendar Accessors

Does anyone know how to get an activity accessor?  Trying to use

Public Sub DeleteActivity( _
   ByVal activity As Activity, _
   ByVal accessor As ActivityAccessor, _
   ByVal allOccurrences As Boolean _
)

but I can only get the accessor id from the activity (which I'm guessing is
the user ID) but I can't seem to use this to get an activityaccessor.  TIA.

 

Tom

Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Calendar Accessors

Hi Tom,

 

Is there a particular reason you need to use this overload and not the 2 param version:

public void DeleteActivity( 
   Activity activity,
   bool bShowMessage
)

I hate the secondary entities object model, its such a horrid mess! Personally I wish the object model inherited from a single Entity Super Object and then bifurcated into two seperate objects Primary and Secondary. That way we would have a more standardised object model and our lives as ACT! devs would not be spent ranting and muttering strangly in the dark corners of our offices!

 

Vivek

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Nickel Super Contributor
Posts: 441
Country: UK

Re: Calendar Accessors

Hi Vivek,

Thanks for the reply... I know how you feel Smiley Happy ... I wanted to use the second method so that I could use the allOccurences as boolean paramater.  I would like to delete all instances of all recurring activities  .

 

Tom

Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Calendar Accessors

Hi Tom,

 

I decided to do a little testing and I think I may have gottena little confuddled somwhere! For some reason I was under the presumption you were working with the Act.UI model and creating a plugin. If you are designing a plugin you can still use the 2 param overload and get the option to select "All Occurances" but it will be a user selection (not great I know!) but it can be used as a workaround.

 

Otherwise, looking through the "documentation", I have got a horrible little feeling that in the implementation of the DeleteActivity method they have used the ActivityAccessor instead of the "lightweight struct" MutableEntities.Accessor object. The reason for this is that the description for the DeleteActivity states "Deletes the specified Activity specified Act.Framework.MutableEntities.Accessor is the Activity's organizer. If the sepecified Accessor is an attendee, the activity is not deleted" which is the wrong object! If it was this object then it would be fairly straightforward using the MutableEntityManager.GetAccessors(Guid[]) method.

 

Maybe someone else might be able to give you a better answer, I'm stumped by this problem! Smiley Sad

 

Vivek

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Nickel Super Contributor
Posts: 441
Country: UK

Re: Calendar Accessors

Thanks for you help, I was trying to do it via the framework, but if I get the choice implementing it through the UI I may have to go with that for now.  I'll keep playing and let you know if I can get it working.

 

Tom

Employee
Posts: 2
Country: United Kingdom

Re: Calendar Accessors

The following creates the ActivityAccessor as well as attempting to delete the activity

 

  

Activity aActivity; Act.Framework.Teams.Team tTeam; // I pulled the guid from the SQL table Guid gGuid = new Guid("c9f0c518-f243-43fc-9f42-4038b135c7de"); // get your Team, User, Resource (i.e. the required ActivityAccessor) tTeam = ActFwk.Teams.GetTeam((Guid)gGuid); // declare and instantiate the accessor Act.Framework.ActivityAccessors.ActivityAccessor aAccessor; aAccessor = new Act.Framework.ActivityAccessors.ActivityAccessor(tTeam.ID, "test", null); // get your Activity or ActivityList ActivityList alActivityList = oActFwk.Activities.GetActivityList(null, null, DateTime.Parse("01/01/1997"), DateTime.Parse("31/12/2010")); aActivity = alActivityList[0]; // check activity exists if (aActivity != null) { // cursory info MessageBox.Show(aActivity.AccessorName);

// delete the activity ActFwk.Activities.DeleteActivity(aActivity, aAccessor, true); }

 

 

 

Unfortunately, the DeleteActivity() method generates "NotSupportedException - Specified method is not supported".

I think you'll need to use the 'ClearActivity()' method (or even just 'aActivity.IsCleared = true' for your activity instances

Nickel Super Contributor
Posts: 441
Country: UK

Re: Calendar Accessors

Thanks for the sample, I'll have a play with this when I have 5 mins Smiley Happy

 

Tom