トップ回答者
【SharePointOnline2013】「リボンのカスタムアクション」の追加によるリボンカスタマイズについて

質問
-
お世話になります。
VisualStudio2013を使って、SharePointOnline2013向けのSharePointホスト型アドインを開発しております。
カスタムリストにリボンを追加しているのですが、追加したタブ、または「リスト」タブを開いてから「アイテム」タブを開こうとすると、
「アイテム」タブの中身がが正常に表示されない事象が発生しております。
Sequence等色々と設定を変えてみたりと試してみたのですが、改善の兆しがありません。
こちらで追加したタブの要素が、デフォルトの「アイテム」タブの要素と重複しているのではないかと考えているのですが、
同様の事象が発生した方、または解決に至る情報をお持ちの方はいらっしゃいませんでしょうか。
以下が上記手順で「アイテム」タブを選択した状態です。(本来なら「アイテム」タブに含まれるメニューの一覧が表示されている状態です)
以上となります。何卒お力添えの程よろしくお願い致します。
- 編集済み sttks 2016年6月20日 12:50 画像添付ミスのため
回答
-
事故解決したため、原因と解決策を展開致します。(知識をお持ちの方ならなにやってるんだ、、、といった内容ですが)
xml自体は様々なサイトを参考にし、もはや内部構造を理解できていないまま動かしていた下記のxmlになるのですが、
「<CommandUIDefinition Location="Ribbon.ListItem._children">」のRibbon.ListItem._childrenが「アイテム」タブの要素を指定しており、「アイテム」タブに干渉した結果、何も表示されなかったようです。
「<CommandUIDefinition Location="Ribbon.ListItem._children">」要素をコメントアウトした所、問題なく表示されるようになりました。
「アイテム」タブに何も表示されなかった具体的な原因としては、Grouptemplateを定義しているにも関わらず、そのテンプレートを使用しなかったため中身に何も定義されていないタブ要素で上書きしてしまったようなイメージなのでしょうか?
また、何故最初に「アイテム」タブを開いた時は問題なく表示がされるのかは掴めておりません。
有識者の方、補足頂ければ幸いです。
以上となります。
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="620177fa-bc75-449c-87d4-c71e587990d3.RunOrientationAdd-in" RegistrationType="List" RegistrationId="100" Location="CommandUI.Ribbon" Sequence="10001" Title="'RunOrientationAdd_in' 動作の呼び出し"> <CommandUIExtension> <!-- コントロールと、カスタム動作に対して有効にするコマンド アクションで 下の UI 定義を更新します。 --> <CommandUIDefinitions> <CommandUIDefinition Location="Ribbon.Tabs._children"> <Tab Id="Ribbon.DemoTab" Title="hogehoge"> <Scaling Id="Ribbon.DemoTab.Scaling"> <MaxSize Sequence="10" Id="Ribbon.DemoTab.Scaling.MaxSize" GroupId="Ribbon.DemoTab.Groups.Group" Size="OneMediumTwoLarge"/> <Scale Sequence="20" Id="Ribbon.DemoTab.Scaling.Scale" GroupId="Ribbon.DemoTab.Groups.Group" Size="OneMediumTwoLarge" /> </Scaling> <Groups Id="Ribbon.DemoTab.Groups"> <Group Id="Ribbon.DemoTab.Groups.Group" Description="This is a custom group!" Title="hogehoge" Sequence="10" Template="Ribbon.Templates.DemoGroupTemplate"> <Controls Id="Ribbon.DemoTab.Groups.Group.Controls"> <Button Id="Ribbon.ListItem.Actions.RunOrientationAdd-inButton" Alt="RunOrientationAdd_in の要求" Sequence="100" Command="Invoke_RunOrientationAdd-inButtonRequest" LabelText="RunOrientationAdd_in の要求" Image16by16="https://hoge.sharepoint.com/sites/hoge/Shared%20Documents/16%C3%9716hoge.png" Image32by32="https://hoge.sharepoint.com/sites/hoge/Shared%20Documents/32%C3%9732hoge.png" TemplateAlias="iconarea1"/> </Controls> </Group> </Groups> </Tab> </CommandUIDefinition> <CommandUIDefinition Location="Ribbon.Templates._children"> <GroupTemplate Id="Ribbon.Templates.DemoGroupTemplate"> <Layout Title="OneMediumTwoLarge" LayoutTitle="OneMediumTwoLarge"> <Section Alignment="Top" Type="TwoRow"> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="textarea1" /> </Row> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="textarea2" /> </Row> </Section> <Section Alignment="Top" Type="OneRow"> <Row> <ControlRef DisplayMode="Large" TemplateAlias="iconarea1" /> </Row> </Section> </Layout> </GroupTemplate> </CommandUIDefinition> <CommandUIDefinition Location="Ribbon.ListItem._children"> <GroupTemplate Id="Ribbon.Templates.DemoGroupTemplate"> <Layout Title="OneMediumTwoLarge" LayoutTitle="OneMediumTwoLarge"> <Section Alignment="Top" Type="TwoRow"> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="textarea1" /> </Row> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="textarea2" /> </Row> </Section> <Section Alignment="Top" Type="OneRow"> <Row> <ControlRef DisplayMode="Large" TemplateAlias="iconarea1" /> </Row> </Section> </Layout> </GroupTemplate> </CommandUIDefinition> </CommandUIDefinitions> <CommandUIHandlers> <CommandUIHandler Command="Invoke_RunOrientationAdd-inButtonRequest" CommandAction="~appWebUrl/Pages/hoge.aspx"/> </CommandUIHandlers> </CommandUIExtension > </CustomAction> </Elements>
- 回答としてマーク 佐伯玲 2016年6月21日 4:07