void editPropertiesMI_Click(object sender, System.Windows.RoutedEventArgs e) { EditItemPropertiesControl editControl = new EditItemPropertiesControl(); //if (UIHelper.ShowDialog(this.Parent editControl, "Edit Properties") == true) //{ //} }
public static void EditItemProperties(ISiteSetting siteSetting, object item, Folder folder) { IServiceManager serviceManager = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType); List <ContentType> contentTypes = serviceManager.GetContentTypes(siteSetting, folder, false);//JD 6/8/13 //list content types for this item List <ContentType> sigleContentTypes = new List <ContentType>(); string webUrl; string listName; int listItemID; string itemContentType; Dictionary <string, string> properties; if (item as SPFolder != null) { webUrl = ((SPFolder)item).GetWebUrl(); listName = ((SPFolder)item).ListName; listItemID = int.Parse(((SPFolder)item).ID); itemContentType = ((SPFolder)item).Properties["ContentTypeId"].ToString(); properties = ((SPFolder)item).Properties; } else { webUrl = ((SPListItem)item).WebURL; listName = ((SPListItem)item).ListName; listItemID = ((SPListItem)item).ID; itemContentType = ((SPListItem)item).Properties["ContentTypeId"].ToString(); properties = ((SPListItem)item).Properties; } foreach (ContentType contentType in contentTypes) { if (contentType.Name.Equals(itemContentType) || contentType.ID.Equals(itemContentType)) { sigleContentTypes.Add(contentType); break; } } EditItemPropertiesControl editControl = new EditItemPropertiesControl(folder.GetWebUrl(), null, sigleContentTypes, null, null, siteSetting, webUrl, properties, true); if (editControl.ShowDialog(null, Languages.Translate("Edit Properties")) == true) { ContentType contentType; Dictionary <object, object> values = editControl.GetValues(out contentType); serviceManager.UpdateListItem(siteSetting, webUrl, listName, listItemID, values, new Dictionary <string, object>()); if (siteSetting.CheckInAfterEditProperties && editControl.requiredFieldsOk & (item as SPListItem != null)) { SPListItem i = ((SPListItem)item); CheckinTypes checktype = siteSetting.useMajorVersionAsDefault ? CheckinTypes.MajorCheckIn : CheckinTypes.MinorCheckIn; serviceManager.CheckInFile(siteSetting, (SPListItem)item, "", checktype); } } }
private Dictionary <object, object> getFieldMappings(string webURL, List <ApplicationItemProperty> properties, List <ContentType> contentTypes, FolderSettings folderSettings, FolderSetting defaultFolderSetting, ISiteSetting siteSetting, string rootFolder, out ContentType contentType, bool displayFileName) { Dictionary <object, object> mappings = new Dictionary <object, object>(); EditItemPropertiesControl editItemPropertiesControl = new EditItemPropertiesControl(webURL, properties, contentTypes, folderSettings, defaultFolderSetting, siteSetting, rootFolder, null, displayFileName); bool?dialogResult = editItemPropertiesControl.ShowDialog(null, Languages.Translate("Mappings...")); if (dialogResult.HasValue == false || dialogResult.Value == false) { contentType = null; return(null); } else { return(editItemPropertiesControl.GetValues(out contentType)); } }