Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • vapenation 21 posts 138 karma points
    Jan 10, 2017 @ 12:45
    vapenation
    0

    UsyncAPI - Import / Export only media and content

    In the Usync-config, you can enable and disable handlers for various type of data:

    <HandlerConfig Name="uSync: DataTypeHandler" Enabled="true" Actions="All" />
    <HandlerConfig Name="uSync: TemplateHandler" Enabled="true" Actions="All" />
    <HandlerConfig Name="uSync: ContentTypeHandler" Enabled="true" Actions="All" />
    <HandlerConfig Name="uSync: MediaTypeHandler" Enabled="true" Actions="All" />
    <HandlerConfig Name="uSync: LanguageHandler" Enabled="true" Actions="All" />
    <HandlerConfig Name="uSync: DictionaryHandler" Enabled="true" Actions="All" />
    <HandlerConfig Name="uSync: MacroHandler" Enabled="true" Actions="All" />
    <HandlerConfig Name="uSync: DataTypeMappingHandler" Enabled="true" Actions="All" />
    <HandlerConfig Name="uSync: MemberTypeHandler" Enabled="false" Actions="All" />
    

    What I want to do is to trigger an Import using the UsyncAPI like:

     var uSyncBackOffice = uSyncBackOfficeContext.Instance;
     uSyncBackOffice.ImportAll(ArgumentThatSpecifiesHandlers);
    

    However, I can't find any overload of ImportAll() that allows you to specify which content you're interested. Does any such functionality exist or do you I have to reconfigure the usyncSettings to achieve this type of selective import?

  • Kevin Jump 1036 posts 6084 karma points mvp c-trib
    Jan 10, 2017 @ 13:28
    Kevin Jump
    100

    Hi

    You can call Import (which ImportAll just wrap's) with the name of the handler group you want to use with this you would need a handler group in the config - but it can be called what ever you want.

    <Handlers Group="customGroup" EnableMissing="false">
        <HandlerConfig Name="uSnyc: DataTypeHandler" Enabled="true"/>
        ...
    

    you can call this :

    uSyncBackOffice.Import("customGroup", folder, force)
    

    you can then turn the features on or off for each element in the group using the Enabled or Actions values.

    all ImportAll actually does is wrap the Import call - with the default folder location, and the force parameter

    (force means import even if you don't think there have been any changes, this slows the import down because everything is imported - and most of the time isn't needed, as usync can work out what has changed and only update what is needed when force = false)

  • vapenation 21 posts 138 karma points
    Jan 12, 2017 @ 08:14
    vapenation
    0

    Perfect! Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft