How to add new portal tab to existing user profiles?

Hi,

i can’t figure this one out… where is the option hidden in Cognos Connection to add a new portal tab to 1000+ user profile? I only can find the option to add the new portal tab to 1 user profile at the time. ???

I read something about SDK code but i am not a programmer…

i believe i have seen some 3rd party tool with this functionallity. But i do not recall which tool… :frowning:

i’ll see if i can find some SDK sample code or link

I found this piece of code on my machine. It is in Csharp not JAVA. But the point is you can do it with the SDK of Cognos.

// Licensed Material - Property of IBM
// © Copyright IBM Corp. 2003, 2009

using System;
using System.Text;
using System.Xml;
using System.IO;
using System.Threading;
using System.Web.Services.Protocols;
using System.Windows.Forms;
using cognosdotnet_2_0;

namespace AddPortalPage
{
	public class Class1
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
       static contentManagerService1 cmService;

       //modify current Namespace
       static string currentNamespace = "CAMID(\"LDAP\")";
        
        //modify diaptcher uri
       static string endPointURL = "http://localhost:9300/p2pd/servlet/dispatch";


        //modify the pagelet search path value
        static string myPageLet = "/content/folder[@name='Samples']/pagelet[@name='Test']";
        //modify name space
        static string namespaceId = "namespaceId";

        //modify user name
        static string userName = "Username";

        //modify password
        static string password = "Password";

		static void Main()
		{
           cmService = new contentManagerService1();
           cmService.Url = endPointURL;

           if (logon(cmService,userName,password,namespaceId))
			{
                try
                {
                    addPortalToAllUsers(myPageLet);
                }

                catch (Exception er)
                { }
				logoff(cmService);
			}
			else
			{
				Console.WriteLine( "Log on failed" );
			}

                     }
		static bool logon(contentManagerService1 cmService,string sInUID, string sInPWD, string sInLDAPNameSpace)
		{
			bool bSuccess = true;
			try 
			{
				StringBuilder credentialXML = new StringBuilder("<credential>" );
				credentialXML.AppendFormat( "<namespace>{0}</namespace>", sInLDAPNameSpace );
				credentialXML.AppendFormat( "<username>{0}</username>", sInUID );
				credentialXML.AppendFormat( "<password>{0}</password>", sInPWD );
				credentialXML.Append( "</credential>" );
				string encodedCredentials = credentialXML.ToString ();

				xmlEncodedXML xmlEncodedCredentials = new xmlEncodedXML();
				xmlEncodedCredentials.Value = encodedCredentials;
				
				cmService.logon(xmlEncodedCredentials, null );
			} 
			catch( Exception e ) 
			{
				bSuccess = false;
				Console.WriteLine( e.ToString() );
			}
			return bSuccess;
		}

		static void logoff(contentManagerService1 cmService)
		{
			cmService.logoff();
		}
        public static void addPortalToAllUsers(string portalPageSearchPath)

        {

            //we get alll the users in the content store- the searchPath can be modified to narrow down the users that will be affected
            baseClass[] bc;
            propEnum[] props = new propEnum[] { propEnum.portalPages, propEnum.searchPath };





            string searchPath = currentNamespace + "//account";
            searchPathMultipleObject mo = new searchPathMultipleObject();
            mo.Value = searchPath;
            bc = cmService.query(mo, props, new sort[] { }, new queryOptions());


            //we get the object in the contentstore that represents the page to be added
            baseClass[] bc2;
            propEnum[] props2 = new propEnum[] { propEnum.searchPath };
            string searchPath2 = portalPageSearchPath;
            searchPathMultipleObject mo2 = new searchPathMultipleObject();
            mo2.Value = searchPath2;
            bc2 = cmService.query(mo2, props2, new sort[] { }, new queryOptions());


            
            //add the portal page to all the users
            foreach (account currentUser in bc)
            {


                //check if the page is not part of the portalPages collection of the current user
                bool portalPageAlreadyExist = false;


                //get the current portal pages of the current user
                baseClass[] accountPortalPages = ((account)currentUser).portalPages.value;


                for (int i = 0; i < accountPortalPages.Length; i++)
                {
                    if (currentUser.portalPages.value[i].searchPath.value.CompareTo(portalPageSearchPath) == 0)
                    {
                        portalPageAlreadyExist = true;
                    }
                }

                //if the page does not exist in portal page collection then add it 
                if (!portalPageAlreadyExist)
                {
                    

                    //create a new collection of portal pages 
                    baseClass[] newPortalPages = new baseClass[accountPortalPages.Length + 1];

                    for (int i = 0; i < accountPortalPages.Length; i++)
                    {

                        newPortalPages[i] = accountPortalPages[i];

                    }

                    //adding the pageLetToThe collectoin of portal pages
                    newPortalPages[accountPortalPages.Length] = bc2[0];

                    baseClassArrayProp toBeUpdated = new baseClassArrayProp();

                    toBeUpdated.value = newPortalPages;
                    ((account)currentUser).portalPages.value = newPortalPages;
                    baseClass[] a = new baseClass[1];
                    a[0] = (baseClass)currentUser;
                    try
                    {
                        baseClass[] returned = cmService.update(a, new updateOptions());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }


                }
            }
        
        
        }


	}
}