private IPortableDeviceValues GetRequiredCreateDirPropertiesForContentType(string parentFolderId, string folderName) { IPortableDeviceValues values = new PortableDeviceTypesLib.PortableDeviceValues() as IPortableDeviceValues; var WPD_OBJECT_PARENT_ID = new _tagpropertykey(); WPD_OBJECT_PARENT_ID.fmtid = new Guid(0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C); WPD_OBJECT_PARENT_ID.pid = 3; values.SetStringValue(ref WPD_OBJECT_PARENT_ID, parentFolderId); var WPD_OBJECT_ORIGINAL_FILE_NAME = new _tagpropertykey(); WPD_OBJECT_ORIGINAL_FILE_NAME.fmtid = new Guid(0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C); WPD_OBJECT_ORIGINAL_FILE_NAME.pid = 12; values.SetStringValue(WPD_OBJECT_ORIGINAL_FILE_NAME, Path.GetFileName(folderName)); var WPD_OBJECT_NAME = new _tagpropertykey(); WPD_OBJECT_NAME.fmtid = new Guid(0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C); WPD_OBJECT_NAME.pid = 4; values.SetStringValue(WPD_OBJECT_NAME, Path.GetFileName(folderName)); var WPD_OBJECT_CONTENT_TYPE = new _tagpropertykey(); WPD_OBJECT_CONTENT_TYPE.fmtid = new Guid(0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C); WPD_OBJECT_CONTENT_TYPE.pid = 7; Guid WPD_CONTENT_TYPE_FOLDER = new Guid(0x27E2E392, 0xA111, 0x48E0, 0xAB, 0x0C, 0xE1, 0x77, 0x05, 0xA0, 0x5F, 0x85); values.SetGuidValue(WPD_OBJECT_CONTENT_TYPE, WPD_CONTENT_TYPE_FOLDER); var WPD_OBJECT_FORMAT = new _tagpropertykey(); WPD_OBJECT_FORMAT.fmtid = new Guid(0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C); WPD_OBJECT_FORMAT.pid = 6; Guid WPD_OBJECT_FORMAT_PROPERTIES_ONLY = new Guid(0x30010000, 0xAE6C, 0x4804, 0x98, 0xBA, 0xC5, 0x7B, 0x46, 0x96, 0x5F, 0xE7); values.SetGuidValue(WPD_OBJECT_FORMAT, WPD_OBJECT_FORMAT_PROPERTIES_ONLY); return(values); }
public IWpdObject CreateDirectory(IWpdObject containerObject, string directoryName) { var values = new PortableDeviceTypesLib.PortableDeviceValues() as IPortableDeviceValues; values.SetGuidValue(ref PortableDevicePKeys.WPD_OBJECT_FORMAT, PortableDeviceGuids.WPD_OBJECT_FORMAT_PROPERTIES_ONLY); values.SetGuidValue(ref PortableDevicePKeys.WPD_OBJECT_CONTENT_TYPE, PortableDeviceGuids.WPD_CONTENT_TYPE_FOLDER); // Parent ID of the new object. values.SetStringValue(ref PortableDevicePKeys.WPD_OBJECT_PARENT_ID, containerObject.ObjectID); // The original file name of the object. values.SetStringValue(PortableDevicePKeys.WPD_OBJECT_ORIGINAL_FILE_NAME, directoryName); // The name of the object on the device. values.SetStringValue(PortableDevicePKeys.WPD_OBJECT_NAME, directoryName); var objectID = string.Empty; containerObject.Content.CreateObjectWithPropertiesOnly(values, ref objectID); return(new WpdObject(objectID, containerObject, containerObject.Content)); }