Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Refile Profile info only
System
I am able to refile a document using IManExt2.RefileCmd but would like to only apply the profile values of the folder and not the security. Is there a way to accomplish this? Here is a snippet of my code:
pExtensions.Add("SelectedContentsContainer", oFolder)
pExtensions.Add("SelectedImanObject", odocument)
pExtensions.Add("IManExt2.RefileNoUI", True)
oRefile.Initialize(pExtensions)
oRefile.Update()
If oRefile.Status = CommandStatus.nrActiveCommand Then
oRefile.Execute()
End If
Thanks,
Ron
Find more posts tagged with
Comments
jny
It does not look like the IManRefileCmd has a contextitem that can facilitate the option of re-filing either only the security or only the metadata.
You could use the Refile (IManDocument) Method to re-file only the metadata. The approach by this method could, however, be quite involved and complicated as you would need to use external mechanism to convert the returned String date value store in the folder's name-value pair to a Date value in order for it to be accepted by the SetAttributeByID (IManProfile) Method. (Date conversion is not supported by the SDK.) Also, you would need to skip any CBool fields found inside the folder.AdditionalProperties collection, when pushing the folder metadata down to the profile object. Like so:
[C#]
====================================
//Example on re-filing doc metadata only.
// Create a blank profile
IManProfile prof = sess.PreferredDatabase.CreateBlankProfile();
// Copy folder additional properties to the blank profile
foreach (IManAdditionalProperty ap in fldr.AdditionalProperties)
{
imProfileAttributeID attID =
GetAttributeIDFromFolderProfileKey(ap.Name);
switch (attID)
{
case imProfileAttributeID.imProfileCustom20 |
imProfileAttributeID.imProfileCustom22 |
imProfileAttributeID.imProfileCustom23 |
imProfileAttributeID.imProfileCustom24:
// TODO: Implement a subroutine, to call, that will convert String to
Date.
break;
case imProfileAttributeID.imProfileCustom25 |
imProfileAttributeID.imProfileCustom26 |
imProfileAttributeID.imProfileCustom27 |
imProfileAttributeID.imProfileCustom28:
// Skip.
break;
default:
prof.SetAttributeByID(attID, ap.Value);
}
}
// Get documents from folder
IManDocuments fldrDox = (IManDocuments)fldr.Contents; foreach
(IManDocument doc in fldrDox) { // Refile document profile only
IManProfileUpdateResult result = doc.Refile(prof, null); }
====================================
Likewise, you could use the Refile (IManDocument) Method to re-file only the security.
====================================
//Example on re-filing security only
// Get documents from folder
IManDocuments fldrDox = (IManDocuments)fldr.Contents;
foreach (IManDocument doc in fldrDox)
{ // Check whether folder is inherited
IManSecurity sec = null;
if (fldr.Security.Inherited == true)
{
IManFolders fldrs = fldr.Path; IManFolder root = fldrs.ItemByIndex(1);
sec = root.Security;
}
else { sec = fldr.Security; } // Refile document profile only
IManProfileUpdateResult result = doc.Refile(blankProf, sec); }
======================================
table.jpg