Unable to add custom user property even if it does not exist - vsto

I have implemented VSTO plug-in for Outlook 2016 / 2019. I have added one custom property. On production, for one user (this user has tried on different machines as well), whenever we try to add our custom property we get exception.
I am using following code snippet :--
UserProperty securedFlag = mailItem.UserProperties.Find("Custom.Secured", true);
int currentValue = -1;
if (securedFlag == null)
{
try
{
securedFlag = mailItem.UserProperties.Add("Custom.Secured", OlUserPropertyType.olInteger, false, OlFormatInteger.olFormatIntegerPlain);
}
catch(System.Exception ex)
{
DarkAddInEventLog.WriteException(ex, "Secure");
}
}
When we execute above code, it is throwing following exception :--
"A custom field with this name but a different data type already exists. Enter a different name."
I have also tried to search same property in non-custom properties by passing false (in second argument of find API) which also throws exception that this property does not exist. Therefore it seems confirmed that this property does not exist before.
Now I have 2 doubts :--
1- If this property does not exist, then why outlook is throwing this error ?
2- Same plug-in is working with other users but only one user is facing this issue. Is it related to some mailbox configuration ?

The error means a property with the same name has already been used in the same mailbox, it might not even be your property, but since all custom properties use the same GUID (PS_PUBLIC_STRINGS), you can run into this problem with duplicate names.
Your only option is to either use a different name (and make sure it is not generic enough to conflict with other properties created by some other apps - e.g. you can prefix all your properties with a unique prefix, such as "MyCompanyProp.") or avoid using UserProperties collection completely and set your custom properties using PropertyAccessor specifying the full DASL name of the named properties with your own custom GUID.

Related

Exchange contact pager number property missing?

I'm trying to get the Pager Number from an Exchange contact. I'm getting the Exchange user from inside an Outlook addin and got access to the Global Address List.
The property should be available with this code, but the property tag doesn't exist it seems. I've found this ID many places, so I'm sure it's correct - or at least was... :)
.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3A21001F")
Found a long list of property tags here: https://msdn.microsoft.com/en-us/library/bb446002.aspx
When I'm using the tag for Pager/Beeper number 0x3A21001F the answer is that it doesn't exist.
If I use another like 0x3A06001F for Given name like this
propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3A06001F") there is no error, but it returns an empty string. So it seems that some properties exist and some don't

How can i create a Dynamic Multi-Select List in hippo cms?

I am trying to create a Dynamic Multi-Select List. I tried to add a DynamicDropdown and added Multiple in Fields properties but throws an error:
An error has occurred, sorry for that.
java.lang.IllegalStateException:
org.onehippo.forge.selection.frontend.plugin.DynamicDropdownPlugin
does not support fields that are multiple: please use
org.onehippo.forge.selection.frontend.plugin.DynamicMultiSelectPlugin
for that. Field name is *. Failed to instantiate plugin class
'org.onehippo.forge.selection.frontend.plugin.DynamicDropdownPlugin'
for wicket id
'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.defaultEditorFactory.cluster.cms-editor0.plugin.editorPlugin.cluster.default.plugin.preview.cluster.default.plugin.dynamicdropdown-preview.cluster..plugin.home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.defaultEditorFactory.cluster.cms-editor0.plugin.editorPlugin.cluster.default.plugin.preview.cluster.default.plugin.dynamicdropdown.cluster.default.service.wicket.id'
in plugin
'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.defaultEditorFactory.cluster.cms-editor0.plugin.editorPlugin.cluster.default.plugin.preview.cluster.default.plugin.dynamicdropdown-preview.cluster..plugin.home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.defaultEditorFactory.cluster.cms-editor0.plugin.editorPlugin.cluster.default.plugin.preview.cluster.default.plugin.dynamicdropdown.cluster.default.plugin.root'
(JcrPluginConfig:/hippo:namespaces/system/DynamicDropdown/editor:templates/default/root)
Indeed the DynamicDropdownPlugin is not meant for multi-selects, you should use the DynamicMultiSelectPlugin. Easiest to install using Essentials set=up tool, see 'Add a Selection Field to a Document Type
Using the Setup Application' at https://documentation.bloomreach.com/library/concepts/plugins/selections/configuration.html
HTH
Jeroen

Determine if i18n is enabled for a JCR Property

How to access the corresponding FieldDefinition, if I have only the jcr property name at hand.
Is there any desired functionality,like find a field definition by a jcr property name ? If not, how would I access configured field definitions in java code ?
Scenario : I need to determine, if a given jcr property name was configured to be an i18n-capable field in definition ?
The answer is you can never be sure if property was configured to be i18n-able (or have any other trait) at the time it was last edited as definition might have changes since.
However to achieve what you want (obtain the definition), what you need to do is:
get a parent node of the property in question,
get value of it's mgnl:template property. That's your templateId,
use the templateId to obtain template from the registry,
read value of dialog property of the template, that's your dialogId
use the dialogId to obtain dialog from the registry
scan tabs in the dialog to find property definition with name of the jcr property you have started with

SOAPUI - SOAPRequest - Expand properties to access name property of current TestStep

SoapUI provides a common syntax to dynamically insert properties in SOAP Request. In their documentation they explain how to access different properties depends on property scope:
#Project# - references a Project property
#TestSuite# - references a TestSuite property in the containing TestSuite
#TestCase# - references a TestCase property in the containing TestCase
#MockService# - references a MockService property in the containing MockService
#Global# - references a global property (optional)
#System# - references a system property
#Env# - references a environment variable
[TestStep name]# - references a TestStep property within the current TestCase
My problem is I want to access the name of the current testStep however documentation says that to access TestStep properties you need the name... There is another way to do so? like for example #TestCase#TestStep#Name. I know how to achieve this with groovy script but in my case I want to put the property directly on SOAP Request.
Thanks in advance
Finally I found the solution in the documentation, with '=' prefix it's possible to specify a groovy script and access to some context variables. In this context request variable is available and also its name property, so It's possible access to the current TestStep name with:
${=request.name}
Example below is grabbing the request from your TestCase and assigning a value to a specific element.
// get XMLHolder for request message def
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context);
// grabbing the specified request
def holder = groovyUtils.getXmlHolder("Specified#Request")
holder["//*:Password"] = 'password1';
For the example above you need to know the Xpath for your element.
Note, that this can be accomplished in several ways, but you specified doing in through groovy script. It can also be done through a #TestCase# property. Example:
<soapenv:Body>
<tns:AuthenticateUser>
<tns:Credentials>
<tns:IntegrationID>${IntegrationID}</tns:IntegrationID>
<tns:Username>${Username}</tns:Username>
<tns:Password>${Password}</tns:Password>
</tns:Credentials>
</tns:AuthenticateUser>

How do you move a SharePoint 2010 DocumentSet from one list to another?

I've tried many variations.
Send To Library - That creates a Zipped file in the Drop Off Library, then it doesn't route via the rules in Content Organizer
API - I've tried to do an Export, Import, but always receive the same error. This is per this MSDN documentation: http://msdn.microsoft.com/en-us/library/microsoft.office.documentmanagement.documentsets.documentset.create.aspx
Sample snippet:
byte[] exportedFile = set.Export();
DocumentSet.Import(exportedFile, DocSetNameToCreate, targetFolder, dsCt.Id, properties, web.CurrentUser);
Error Received:
DocID: Site prefix not set.
Finally got it to run. This is related to the Document ID Feature. Make sure it is activated in each site. Let is run over night (timer jobs need to run). Then the content organizer will successfully move and unpackage your document sets.
You don't have to activate the document id feature, just ensure that in the property bag of the root web of the destination site collection (where the document set will be imported again) exists a property named "docid_msft_hier_siteprefix" with an value of "" (empty string).
Use this powershell-script:
$site = Get-SPSite http://host/sites/yoursite
$properties = $site.RootWeb.Properties
if ($properties["docid_msft_hier_siteprefix"] -eq $null)
{
$properties["docid_msft_hier_siteprefix"] = ""
$properties.Update()
}
Note that i use the old property bag RootWeb.Properties instead of the new hashtable RootWeb.AllProperties, thats because the class Microsoft.Office.DocumentManagement.Internal.OobProvider still uses that.
So why is it failing when a document set is imported? The function DocumentSet.ImportProperties() catches an ArgumentException while trying to set the document id of the document set list item (so there's no problem if the document id column doesn't exist yet).
But they missed that the function OobProvider.GetSitePrefix() which is called through the function OobProvider.GenerateDocumentId() throws an InvalidOperationException if the property bag doesn't contain the prefix property.