Get MS Project Title (Not Name) - vba

I need to get the Title of a project rather than the name of it. This can be done using the ProjectSummaryInfoEx method for the application object but I'm not sure how to get this line to return the value I need. Without any commands, it simply opens up the Summary info dialog box, and any inputs I provide come back as an invalid argument.
Any help anyone can provide would be greatly appreciated.

I suggest using:
ActiveProject.BuiltinDocumentProperties("Title")
or a property of the Project object such as:
ActiveProject.Name
References: Application object, Project object, BuiltinDocumentProperties

In addition to Rachel's answers, you can also use this:
ActiveProject.Tasks.UniqueID(0).Name
UID zero will always be the project summary task, and the name property will be the title of the project.

Related

Minecraft Spigot I cannot get String from Component

Hello Support I can't get the String from a Component. I did this with 2 ways with bad results.
TextComponent textComponent = (TextComponent) item.displayname;
return textComponent.content();
The result of this is a error with Casting
and
return PlainTextComponentSerializer.plainText().serialize(item.displayname);
The result of this is Literaly "chat.square_brackets" which is weird.
Please Help. Thanks
I also was having trouble with this. Here's what I found to work for me. Full disclosure that I'm developing my plugin on the PaperMC 1.16 fork and not Spigot. So it's possible that this may not work for you, either because it isn't a part of Spigot or because you are working in a version that this feature is not a part of.
To start, I would first check to make sure that we are both on the same page. For me, the component objects being used are from a package called net.kyori.adventure.text if yours are not provided by this package I don't know that this solution will work for you.
Also as mentioned by others, accessing the displayName directly on the ItemStack isn't going to give the desired results. Instead, you need to do itemStack.getItemMeta().displayName(). This method should then return a net.kyori.adventure.text.Component; once you have the component you need to serialize it using one of the serializers from the previously mentioned package.
That will look something like this:
Component itemDisplayName = itemStack.getItemMeta().displayName()
PlainComponentSerializer plainSerializer = PlainComponentSerializer.plain();
String itemName = plainSerializer.serialize(itemDisplayName);
The package that the serializer is from is: net.kyori.adventure.text.serializer.plain.PlainComponentSerializer
I don't understand how you can access to the displayname field in ItemStack in the Spigot API.
You should use ItemMeta to manage display name. To get the item meta, you should use ItemStack#getItemMeta.
Don't forget to check if the item as a meta with hasItemMeta. You can also use hasDisplayName to be sure that the display name is valid.

How to clone a UserPrincipal object in VB.NET

I'm trying to create a new User in Active Directory from a VB.NET application. Most fields will be identical to an already existing "template" user, except things like Name, SurName, Email, SamAccountName, etc.
So I want to copy or clone this template User, assign the few fields with a new/different value and then save this new user in Active Directory. I'd like to avoid having to manually assign who-knows how many properties from my template to the new User and maybe forget something along the way..
Is there not a way to do that? I found something about using DirectoryEntry.CopyTo(), but I simply get a "Not implemented" error, and anyway I doubt this is the right direction (Unsure how to use this class together with a UserPrincipal object)
Should I be using a different class than System.DirectoryServices.AccountManagement.UserPrincipal to save my new user in the AD? Do I have the wrong approach?
Any help will be appreciated :)
If you look at the source code for DirectoryEntry.CopyTo, it calls:
newParent.ContainerObject.CopyHere(Path, newName)
And ContainerObject is of the type IADsContainer. If you look at the documentation for IADsContainer.CopyHere, it says (under Remarks):
The providers supplied with ADSI return the E_NOTIMPL error message.
ADSI is "Active Directory Service Interfaces". So the short answer is that it just won't work with AD objects.
There is no way to do what you want. You will have to manually assign each attribute you want to copy.

In InstallShield, how to change the value of my Property before it is used by SQL Text Replacement?

What I want to do
In InstallShield I want to set the value of a Property before it is used by the SQL Text Replacement feature. I want the new Property value to come from an Edit control that I've added to a dialog.
What I've done so far
I have added SQL Scripts to my InstallShield project, which include placeholders for InstallShield's Text Replacement feature. I've used the Text Replacement tab to find and replace a placeholder in the SQL script with the value of a Property that I've added to the Property Manager. This works correctly, but only for the Property's default value.
Where I'm stuck
The problem is that I want the new value to come from an Edit control in my custom Dialog, but I can't find a way to do this. Text Replacement always uses the Property's default value.
What I've tried is the following InstallScript, which runs when the user clicks Next on my custom Dialog:
CtrlGetText("MyDialog", EDIT_VALUE_FROM_USER, svValueFromUser);
MsiSetProperty ( hwndDlg, "EDIT_VALUE_FROM_USER", svValueFromUser);
Where EDIT_VALUE_FROM_USER is my Property. This runs without error, but the value doesn't come through to the final SQL script.
Why isn't the new value for EDIT_VALUE_FROM_USER being used by SQL Text Replacement? How can I diagnose why it's not working? Should I be doing this in a completely different way?
This turned out to be because I wasn't using the system property ISMSI_HANDLE.
So the correct code to write a Property from an Edit control in a custom dialog is:
CtrlGetText("MyDialog", EDIT_VALUE_FROM_USER, svValueFromUser);
MsiSetProperty (ISMSI_HANDLE, "EDIT_VALUE_FROM_USER", svValueFromUser);
I'm guessing your property isn't listed in the SecureCustomPublicProperties property and is getting set back to it's default value when the installer transitions to the install execute sequence. A log file of the installation would give more data to work with.

Maximo - Adding elements to a CustomMboSet using scripting

Is it possible to add to a CustomMboSet in Maximo using scripting? I am writing a custom application using a custom object called TIMESHEET. As part of the application I am writing a (Jython) script that needs to dynamically build up an MboSet (a set of TIMESHEETs). The code retrieves an existing CustomMboSet and attempts to add elements to it. It works when using an out of box MboSet, but when I try to run the same code on a custom MboSet it does not seem to work. No error is thrown, but code below the offending line is not run.
In other words, this works (LABTRANS is an out of box MBO):
myMboSet = mbo.getMboSet("LABTRANS")
newMbo = myMboSet.add()
# Set attributes on newMbo, everything is happy
But this does not (TIMESHEET is a custom MBO):
myMboSet = mbo.getMboSet("TIMESHEET")
newMbo = myMboSet.add()
# Code does not execute after the above line
Anyone have any insight as to why I am seeing this behavior? Does the Maximo scripting framework simply not support the dynamic building up of CustomMboSets? Any help is appreciated. Thanks.
You need to make sure that the relationship exists between the Current MBO and the Custom MBO in the database configuration otherwise it will not work.
Alternatively you can use the following code to create an new mboSet on the fly:
timeSheetMboSet = mxServer.getMboSet("TIMESHEET", userInfo)
mbo.getMboSet(RELATIONSHIPNAME).
LABTRANS and TIMESHEET must be the relationship names to the object in auto script.
If you want to get/add records in any object, use
mxServer.getMboSet(OBJECTNAME, userInfo)
A bit more explanation. You can create your own custom relationship from within your automation script. The trick is to make sure it's not already existing. That's why I use a dollar sign for mine.
variable = mbo.getMboSet(tempRelationshipName,Object,where clause)
previousPhaseSet = mbo.getMboSet("$wophasetranstemp1", "exitdate is null")

Displaying Custom Attributes in Documentum - Webtop

I am following an article that explains how to use the ICustomAttributeDataHandler class.
I am creating a custom column for the inbox screen, but the problem is that the value I set for my custom attribute is not being reflected on the screen.
As a test I am changing the task name to "whoKnows". But this code is not effecting what is output on the screen:
ICustomAttributeRecordSet.setCustomAttributeValue(i, "taskName", "whoKnows");
(I am able to print debug lines from my custom class when the inbox is viewed, so I know my code is being run.)
Someone on the comments of that article wrote:
the user must call the
"setCustomAttributesInQuery() method
on the dataprovider passing in a
string array of the custom attributes
...what does that meen? Could this be my problem?
thanks.
To be honest, I have already used Webtop, but just as an user. I found a post in the dm developer discussion group that can be useful, though:
For creating a custom column in the
doclist you dont need to go through
this complex procedures. You can use
custom attribute datahandlers for
this.
First in your object list component xml file add your custom column
definition in the "columns" tag. You
can even add static columns instead of
the documentum attributes.
Now create a class which implements the ICustomAttributeDataHandler.
Implement the default the methods getRequiredAttributes and the getData
function.
In getRequiredAttributes add attributes of the object that you are
looking for.
In your getdata method retrieve each row and then based on the
attribute that you see, just set the
value that you want to. 6) Finally
define your class in the app.xml file
There is a section in WDK developement
guide regarding
ICustomAttribuetDataHandlers. Look for
the topic named "Adding custom
attributes to a datagrid".
I'm not sure if this is the final solution, but I hope it helps!
To answer you question about setCustomAttributesInQuery()
every datagrid in WDK is backed by an underlying data provider. You can get this proivder by using the following code.
Datagrid datagrid = (Datagrid)getControl("doclist_grid",com.documentum.web.form.control.databound.Datagrid.class);
DataProvider dp = datagrid.getDataProvider();
Once you've done that, you can call
dp.setCustomAttributesInQuery(myArr);
I'm not actually sure if this is part of the solution to your problem, but you could try this and see where it gets you.
You have to configure the inbox component.
if using classic view, go to inboxlist component and add your custom attribute.
<column>
<attribute>CustomAttributeName</attribute>
<label>Custom Attribute Label</label>
<visible>true</visible>
</column>
Your custom attribute has to be in a custom type that is a sub type of dmi_queue_item, because inboxlist shows only dmi_queue_item objects.
Hope this helps,
Regards,
Tejas.
This may be a non-issue, but based on your code, I can't tell if you're doing this:
ICustomAttributeRecordSet.setCustomAttributeValue(i, "taskName", "whoKnows");
or this:
ICustomAttributeRecordSet rs;
rs.setCustomAttributeValue(i, "taskName", "whoKnows");
You should be calling the setCustomAttributeValue method on the rs object instance, not on the interface.