Я ссылался на код переносимого устройства, написанный на C ++.
Для создания папки необходимы три ключа.
WPD_OBJECT_CONTENT_TYPE = WPD_CONTENT_TYPE_FOLDER
WPD_OBJECT_PARENT_ID
WPD_OBJECT_NAME
public void createFolder(string folderName, string parentObjectId)
{
IPortableDeviceContent content;
this._device.Content(out content);
string objectID = null;
IPortableDeviceValues values = GetRequiredPropertiesForFolderType(folderName, parentObjectId);
content.CreateObjectWithPropertiesOnly(values, objectID);
}
private IPortableDeviceValues GetRequiredPropertiesForFolderType(string folderName, string parentObjectId)
{
IPortableDeviceValues values = new PortableDeviceTypesLib.PortableDeviceValues() as IPortableDeviceValues;
//type
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;
var WPD_CONTENT_TYPE_FOLDER = new _tagpropertykey();
WPD_CONTENT_TYPE_FOLDER.fmtid = new Guid(0x27E2E392, 0xA111, 0x48E0, 0xAB, 0x0C, 0xE1, 0x77, 0x05, 0xA0, 0x5F, 0x85);
values.SetGuidValue(ref WPD_OBJECT_CONTENT_TYPE, WPD_CONTENT_TYPE_FOLDER.fmtid);
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, parentObjectId);
//name
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, folderName);
return values;
}