2011-01-14 3 views
0

Outlook 2007 AppointmentItem에 대한 사용자 지정 리본을 만들었습니다. AppointmentItem에는 사용자 지정 속성이있을 수 있습니다. 사용자 정의 속성을 설정하면 사용자 정의 리본의 버튼을 비활성화해야합니다 (기본적으로 활성화 됨).리본에서 리본의 단추를 변경하십시오.

사용자 지정 리본에서 _Load 함수를 시도했지만 단추가 여전히 사용 가능합니다. 디버깅 할 수 있습니다. 문자열이 채워지고 버튼이 비활성화되지만 프론트 엔드에서는 아무 것도 발생하지 않습니다.

public partial class Ribbon1 { 
[...] 
    private void Ribbon1_Load(object sender, RibbonUIEventArgs e) 
    { 
     if (myCustomProperty != "") 
     { 
      Globals.Ribbons[Globals.ThisAddIn.Application.ActiveInspector()] 
       .Ribbon1.buttonCollaborate.Enabled = false; 
     } 
    } 
    [...] 
} 

내가 무슨 잘못이 Globals.Ribbons[...].Ribbon1 수 있습니다 모른다는 현재 리본 아닌가요? 또는 ribbon_load_finish_method가 있습니까?

VisualStudio 2010 및 .Net 3.5를 사용했습니다.

감사합니다!

답변

0

왜 모든 rigamarole을 통과합니까? 필자는 레지스트리 항목을 기반으로 버튼을 설정해야했던 것과 비슷한 (메일 항목의 경우 약속이 아니라) 비슷한 것을 작성해야했습니다. 이것은 나의 접근이었다. 나는 완벽하다고 말하는 것이 아니지만 그것은 나를 위해 일했습니다.

string taglineActive; 
OLRegistryAddin buttonSet = new OLRegistryAddin(); // variable for reading the value of the registry key 
UpdateBody msgBody = new UpdateBody(); // method for adding/removing tagline from the message 

private void Ribbon1_Load(object sender, RibbonUIEventArgs e) 
{ 
    taglineActive = buttonSet.RegCurrentValue(); // retrieve the current registry value 

    if (taglineActive == "0") 
    { 
     // tagline is off for all messages 
     ActiveAllMessages.Checked = false; // uncheck "All Messages" button 
     ActiveAllMessages.Label = "Inactive - All Messages"; // change the label 
     ActiveThisMessage.Visible = false; // hide the "This Message" button 
     ActiveThisMessage.Enabled = false; // deactivate the "This Message" button 
    } 
    else if (taglineActive == "1") 
    { 
     // tagline is on for all messages 
     ActiveAllMessages.Checked = true; // check "All Messages" button 
     ActiveAllMessages.Label = "Active - All Messages"; // change the label 
     ActiveThisMessage.Visible = true; // show the "This Message" button 
     ActiveThisMessage.Enabled = true; // activate the "This Message" button 
    } 
: 여기

내 (실수) 코드에서 조각입니다
관련 문제