The following sample code shows how you can modify the name of an existing avatar:
[C#]
using CMS.SiteProvider;
...
// Get avatar object by AvatarID AvatarInfo ai = AvatarInfoProvider.GetAvatarInfoWithoutBinary(avatarID);
// Change avatar name ai.AvatarName = ai.AvatarName + "_Updated";
// Save avatar object AvatarInfoProvider.SetAvatarInfo(ai); |
The following sample code shows how you can create a new pre-defined avatar of type 'All' and add it to the system:
[C#]
using CMS.SiteProvider;
...
// Create new avatar object AvatarInfo ai = new AvatarInfo("\\Directory\\custom.jpg");
// Set properties ai.AvatarName = "New avatar"; ai.AvatarType = AvatarInfoProvider.GetAvatarTypeString(AvatarTypeEnum.All); ai.AvatarIsCustom = false;
// Save object to database AvatarInfoProvider.SetAvatarInfo(ai); |
Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_modifying_and_creating_avatars.htm