Home > 2010 > Registering pageComponent using ClientObjectModel

Registering pageComponent using ClientObjectModel

January 28Hits:15

is there any ways to register PageComponent using client object model? I want to add custom action on the edit form with dynamically populating FlyoutAnchor. But when page has been loaded i recieve following error "Uncaught ReferenceError: CUI is not defined ". I think this is because my page component was not loaded. I'm trying to do this by this code(C#):

ClientContext context = new ClientContext(TargetUrl); var site = context.Site; var populate = site.UserCustomActions.Add(); populate.Title = "PopulateDropDown"; populate.Location = "ScriptLink"; populate.ScriptBlock =          "Type.registerNamespace(\'COB.SharePoint.Ribbon.PageComponent\');" +         "COB.SharePoint.Ribbon.PageComponent = function () {" +              "COB.SharePoint.Ribbon.PageComponent.initializeBase(this);" +         "};" +          "COB.SharePoint.Ribbon.PageComponent.initialize = function () {" +              "ExecuteOrDelayUntilScriptLoaded(Function.createDelegate(null,   COB.SharePoint.Ribbon.PageComponent.initializePageComponent), \'SP.Ribbon.js\');" +          "};" +          "COB.SharePoint.Ribbon.PageComponent.initializePageComponent = function() {" +              "var ribbonPageManager = SP.Ribbon.PageManager.get_instance();" +              "if (null !== ribbonPageManager) {" +                  "ribbonPageManager.addPageComponent(COB.SharePoint.Ribbon.PageComponent.instance);" +              "}" +          "};" +          "COB.SharePoint.Ribbon.PageComponent.prototype = {" +              "init: function () { }," +           // some code there           "};" +          "function PopulateDropDown(commandId, properties, sequence){" +             "var sb = new Sys.StringBuilder();" +             "sb.append(\"<Menu Id=\'Sample.account.form.Menu\'>\");" +             "sb.append(\"<MenuSection Id=\'Sample.account.form.MenuSection\' Title=\'Menu Section Title\' Sequence=\'15\'>\");" +             "sb.append(\"<Controls Id=\'Sample.account.form.MenuSection.Controls\'>\");" +             "sb.append(\"<Button Id=\'Sample.account.form.Controls.Button.FirstButton\' Command=\'Sample.ButtonCommand.Command\' LabelText=\'First Button\' ToolTipTitle=\'First Button\' ToolTipDescription=\'The first button\' TemplateAlias=\'o2\' Sequence=\'20\' />\");" +         "   sb.append(\"</Controls>\");" +            "sb.append(\"</MenuSection>\");" +            "sb.append(\"</Menu>\");" +            "CommandProperties.PopulationXML = sb.toString();return true;" +         "};"  +   "COB.SharePoint.Ribbon.PageComponent.registerClass(\'COB.SharePoint.Ribbon.PageComponent\', CUI.Page.PageComponent);" +         "COB.SharePoint.Ribbon.PageComponent.instance = new COB.SharePoint.Ribbon.PageComponent();" +         "NotifyScriptLoadedAndExecuteWaitingJobs(\'COB.SharePoint.Ribbon.PageComponent.js\');";          populate.Update();         context.Load(site, oList => oList.UserCustomActions);         context.ExecuteQuery(); 


This should be added in the end of script. It's work.

            "ExecuteOrDelayUntilScriptLoaded ( function () {" +
            "COB.SharePoint.Ribbon.PageComponent.registerClass(\'COB.SharePoint.Ribbon.PageComponent\', CUI.Page.PageComponent);" +
            "COB.SharePoint.Ribbon.PageComponent.instance = new COB.SharePoint.Ribbon.PageComponent();" +
            "COB.SharePoint.Ribbon.PageComponent.initialize()"" }, \"CUI.js\" );";

Related Articles

  • Registering pageComponent using ClientObjectModelJanuary 28

    is there any ways to register PageComponent using client object model? I want to add custom action on the edit form with dynamically populating FlyoutAnchor. But when page has been loaded i recieve following error "Uncaught ReferenceError: CUI is not

  • FlyoutAnchor PopulateQueryCommand through clientContextJanuary 24

    I have a problem. I want to add Custom action on a Sharepoint Edit form. This must be FlyoutAnchor and i want generate his content dynamically. I'm adding them throuh ClientContext object model(using C#). This is my code(part omitted): string format

  • The Case for Registering Multiple DomainsOctober 30

    Via /. – Optimizing Page Load Time has some very interesting insight, in particular this point; By default, IE allows only two outstanding connections per hostname when talking to HTTP/1.1 servers or eight-ish outstanding connections total. Firefox h

  • Delete a blank line but don't add it to the vim register September 10

    Possible Duplicate: Any way to delete in vim without overwriting your last yank? Using vim I often want to replace a block of code with a block that I just yanked. But when I delete the block of code that is to be replaced, that block itself goes int

  • 'Microsoft.ACE.OLEDB.15.0' provider is not registered on the local machine October 26

    I have a Visual Studio 2008 solution with two projects (a Word-Template project and a VB.Net console application for testing). Both projects reference a database project which opens a connection to an MS-Access 2007 database file and have references

  • Is possible to arbitrarily register names to the same public IP?May 1

    I registered a domain, lets say mysite.com (for example), then, results that somebody else has an A record from anotheraddress.com pointing to the same IP address of mine (in a VPS in linode.com) What can I do to avoid this???, I mean, I would prefer

  • Can I "register" python scripts to execute on Windows?May 4

    I have Python 2.5 installed on Windows XP and a collection of scripts available in a certain directory. According to this article by Amanda Birmingham I can setup up a path for the Python executable and the one for where the scripts live. Which means

  • How to register server HBAs to an EMC Clariion storage systemMay 29

    I have just attached a Solaris box (an old Enterprise 420R) to a Clariion storage array via an Emulex HBA but the Navisphere software is only seeing the system via a hexadecimal reference ID not by the agent's hostname. When trying to assign storage

  • How do I register Linux server with Windows DNS serverJune 4

    I have several Ubuntu machines (mostly 8.04) that I would like to register their hostnames (or desired hostnames) with my main DNS server running on Windows 2000 so that I can access these machines from any other machine using that DNS server by host

  • Setting "Register this connection's addresses in DNS" using GPOJune 19

    I need to get the Windows XP client machines in my network to dynamically update their DNS A records. The network is an AD domain running on Windows Server 2003 R2 servers with Win XP SP3 clients. Some machines already have the "Register this connect

  • Establishing Subdomains with Registered Domains, DynDNS Forwarding, and OpenwrtJune 22

    I have a registered domain name (thisexample.net), which I forward to a dynamic URL at DynDns (bounce.dnsalias.net) as my internet access comes over cable and doesn't provide a static IP address. My router (openwrt) forwards port 80 to an apache serv

  • Finding all domains registered in a nameserverJuly 17

    Up until now, I was pretty confident that it was pretty much impossible to list all the domains handled by a nameserver. But apparently, there exists a couple of websites on the Internet that are able to list all the domains registered in a namerserv

  • Windows DNS keeps re-registering deleted ip addressesJuly 19

    I have 2 nameservers running Windows Server 2008. On these servers we have routeable and private/non-routeable ( 10. _ . _ ._ ) IPs. The problem is that a query for the nameserver's network name returns non-routeable ips. These IPs need to be on the

  • Polycom Not Registering against AsteriskJuly 24

    We have several Polycom 301s in the office along with 501s, 601s and SoundStation 4001s. Recently several of the 301s and a 4001 have stopped being able to register against Trixbox/Asterisk server and additional phones are starting to exhibit this be

  • When registering a domain, which extentions should be avoided? July 30

    I'm planning to register few domains for my own portfolio, a personal blog and another for a side business. Ideally I would like to get all domains ending in .com, but if I am unable to do so, is the next best option to go for a domain ending in .net

  • Multiple IP addresses on one NIC register twice in DNS serverAugust 21

    We've got a build server (Windows Server 2008 SP2, 64-bit) which has one NIC and two IP addresses registered to that NIC ( and The build server is registering two identical Host (A) records for itself in our DNS server: bui

  • How does IE register ActiveX controls?August 24

    How does IE register ActiveX controls for use in the browser? Does it just run regsvr32 for the DLL? --------------Solutions------------- ActiveX components register themselves, triggered by a well known DLL entry point (DllRegisterServer). regsvr32

  • Tutorial: from registered domain to running mail server on ADSL connection?August 24

    Does anyone know of a tutorial that takes me from having registered a domain name (with eNom through Google) to a running IMAP mail server (preferably based on Ubuntu) connected to the internet via a ADSL connection? I am looking for something quite

  • What's required for a nameserver to be registered?September 1

    I'm trying to change nameservers for some of my domains at GoDaddy, but I occasionally run into "Nameserver not registered" problems, and then I'm not allowed to set the nameservers. Here are the cases I've tried, and I still don't understand wh

  • What would cause inability to register/unregister DLLs on an Admin accountSeptember 3

    I've been installing IBM Rational Software on and off for the past couple months - on my computer and a few others around the workplace; and I've never run into a problem like this. The install files for several products are on a shared drive; when i

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.342 s.