System.Management.Automation.MethodInvocationException: Exception calling "ExecuteQuery" with "0" argument(s): "$Resources:core,ImportErrorMessage;" --- Microsoft.SharePoint.Client. ServerException: $Resources:core,ImportErrorMessage;

Hi,
I am getting an error  System.Management.Automation.MethodInvocationException: Exception calling "ExecuteQuery" with "0" argument(s): "$Resources:core,ImportErrorMessage;" ---> Microsoft.SharePoint.Client. ServerException:
$Resources:core,ImportErrorMessage;
Following is my powershell script on line
$context.ExecuteQuery(); it is throwing this error.
function AddWebPartToPage([string]$siteUrl,[string]$pageRelativeUrl,[string]$localWebpartPath,[string]$ZoneName,[int]$ZoneIndex)
    try
    #this reference is required here
    $clientContext= [Microsoft.SharePoint.Client.ClientContext,Microsoft.SharePoint.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c]
    $context=New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
    write-host "Reading file " $pageRelativeUrl
    $oFile = $context.Web.GetFileByServerRelativeUrl($pageRelativeUrl);
    $limitedWebPartManager = $oFile.GetLimitedWebPartManager([Microsoft.Sharepoint.Client.WebParts.PersonalizationScope]::Shared);
    write-host "getting xml reader from file"
    $xtr = New-Object System.Xml.XmlTextReader($localWebpartPath)
     [void] [Reflection.Assembly]::LoadWithPartialName("System.Text")
    $sb = new-object System.Text.StringBuilder
         while ($xtr.Read())
            $tmpObj = $sb.AppendLine($xtr.ReadOuterXml());
         $newXml =  $sb.ToString()
    if ($xtr -ne $null)
        $xtr.Close()
    #Add Web Part to catalogs folder
    write-host "Adding Webpart....."
    $oWebPartDefinition = $limitedWebPartManager.ImportWebPart($newXml);
    $limitedWebPartManager.AddWebPart($oWebPartDefinition.WebPart, $ZoneName, $ZoneIndex);
$context.ExecuteQuery();
    write-host "Adding Web Part Done"
    catch
    write-host "Error while 'AddWebPartToPage'" $_.exception| format-list * -force
ERROR:
Error while 'AddWebPartToPage' System.Management.Automation.MethodInvocationException: Exception calling "ExecuteQuery" with "0" argument(s): "$Resources:core,ImportErrorMessage;" ---> Microsoft.SharePoint.Client.
ServerException: $Resources:core,ImportErrorMessage;
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
   at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
   at ExecuteQuery(Object , Object[] )
   at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[] originalArguments)
   --- End of inner exception stack trace ---
   at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[] originalArguments)
   at System.Management.Automation.DotNetAdapter.MethodInvokeDotNet(String methodName, Object target, MethodInformation[] methodInformation, Object[] arguments)
   at System.Management.Automation.Adapter.BaseMethodInvoke(PSMethod method, Object[] arguments)
   at System.Management.Automation.ParserOps.CallMethod(Token token, Object target, String methodName, Object[] paramArray, Boolean callStatic, Object valueToSet)
   at System.Management.Automation.MethodCallNode.InvokeMethod(Object target, Object[] arguments, Object value)
   at System.Management.Automation.MethodCallNode.Execute(Array input, Pipe outputPipe, ExecutionContext context)
   at System.Management.Automation.ParseTreeNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
   at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeNode statement, Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
       

Thanks Sethu for your comments. However i am running this powershell directly on server so believe
SharePointOnlineCredentials is not required.
I have tried it but still giving me same error

Similar Messages

  • Exception calling "Update" with "0" argument(s): "To add an item to a document library, use SPFileCollection.Add()"

    Hi i am trying to add a new item and update existing field value in a document library with powershell 
    but i receive below error message.
    PS C:\Users\spfarm> C:\Scripts\add.ps1
    Exception calling "Update" with "0" argument(s): "To add an item to a document
    library, use SPFileCollection.Add()"
    At C:\Scripts\add.ps1:24 char:16
    + $newItem.Update <<<< ()
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException
    #Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets
    Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
    #Variables that we are going to use for list editing
    $webURL = "http://tspmcwfe:89"
    $listName = "test"
    #Get the SPWeb object and save it to a variable
    $web = Get-SPWeb $webURL
    #Get the SPList object to retrieve the "Demo List"
    $list = $web.Lists[$listName]
    #Create a new item
    $newItem = $list.Items.Add()
    #Add properties to this list item
    $newItem["Title"] = "My second item!"
    $newItem["Info"] = "s15"
    #Update the object so it gets saved to the list
    $newItem.Update()
    $web.Dispose()
    adil

    Hi Adil,
    Document Library is different from a normal list. The document library contains files inside it. You need to update the code to add a document to the library. Then you can get hold of the List Item represented by that file and update its properties. Here
    is an example:
    $WebURL = "http://aissp2013/sites/TestSite"
    $DocLibName = "Docs" 
    $FilePath = "c:\blogs.txt" 
    # Get a variable that points to the folder 
    $Web = Get-SPWeb $WebURL 
    $List = $Web.GetFolder($DocLibName) 
    $Files = $List.Files
    # Get just the name of the file from the whole path 
    $FileName = $FilePath.Substring($FilePath.LastIndexOf("\")+1)
    # Load the file into a variable 
    $File= Get-ChildItem $FilePath
    # Upload it to SharePoint 
    $spFile = $Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(),$false) 
    $item = $spFile.Item
    $item["Title"] = "New Title"
    $item.Update()
    $web.Dispose()
    Blog | SharePoint Learnings CodePlex Tools |
    Export Version History To Excel |
    Autocomplete Lookup Field

  • Query AD cause Exception calling "FindAll" with "0" argument(s)

    Hi all,
    When I query an entry property of AD with PowerShell, i got some problems. Here is the script, what's wrong ? Any idea? Thanks!
    Cause error at last line code. (Exception calling "FindAll" with "0" argument(s): "There is no such object on the server)
    $MailboxServer = Get-MailboxServer -Identity $Env:COMPUTERNAME -ErrorAction SilentlyContinue
    $dc = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
    $exchOAB = New-Object System.DirectoryServices.DirectoryEntry("LDAP://" + $dc.Name + "/cn=Offline Address Lists,cn=Address Lists Container, " + $MailboxServer.DistinguishedName)
    $objSearcher = New-Object System.DirectoryServices.DirectorySearcher
    $objSearcher.SearchRoot = $exchOAB
    $objSearcher.PageSize = 1000
    $objSearcher.SearchScope = "OneLevel"
    $objSearcher.Filter = "(objectClass=msExchOAB)"
    $powershellOAB = $objSearcher.FindAll()

    This is one of, now, four duplicate posts.
    ¯\_(ツ)_/¯

  • Exception calling "Activate" with "0" argument(s): "Topology does not contain any components of type Microsoft.Office.Server.Search.Administration.Topology.AdminComponen

    Hi,
    I have a Sharepoint 2013 farm I am trying to provision search for (not the same as my other thread). However, I get the below error:
    Exception calling "Activate" with "0" argument(s): "Topology does not contain any components of type Microsoft.Office.Server.Search.Administration.Topology.AdminComponent"
    In my script, I have the following:
    New-SPEnterpriseSearchAdminComponent -SearchTopology $clone  -SearchServiceInstance $SearchServiceInstanceServer3 -ErrorAction SilentlyContinue
    So I am not sure why the error happens, when I am trying to set this component. However, it's not the first component to be set (index partition on non-local servers first). I can make it first, but why does this error happen?
    UPDATE: I have noticed that the usage and health proxy on my farm is/was stopped, but I am not able to access the server(s) to look at this right now. Could this cause this issue?

    Do you already have Admin component running for the Search Service Application?
    Usage and Health Service will not cause this issue.
    Please also refer to below discussion to see if it helps:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/02f0b072-aa3a-4b7f-9662-2caf373d1e57/setspenterprisesearchtopology-identity-newtopology?forum=sharepointgeneral
    Warm Regards,
    Bhavik K Jain
    Sr. Software Engineer - SharePoint Administration
    Please vote if my reply helps and ensure that you mark a question as Answered once you receive a satisfactory response.

  • Exception calling "ExecuteNonQuery" with "0" argument(s): "CommandText property has not been initialized.

    I have CSV file  which has sdimiler  data I am inserting those  date to desinated table and while executing this  query mentioned below I get error mentioned in TITLE
    insert into SU_EDIT_DETAIL(EDIT_FUNCTION, TABLE_FUNCTION, CODE_FUNCTION, CODE_TYPE,CODE_BEGIN, CODE_END, EXCLUDE, INCLUDE_X, OP_NBR, TRANSCODE, VOID, YMDEFF, YMDEND, YMDTRANS)"
    select  $($line."EDIT_FUNCTION"),($line."TABLE_FUNCTION"), ($line."CODE_FUNCTION"),'DIAG', ($line."CODE_BEGIN"), ($line."CODE_END"),' ',' ',' ','MIS', 'C',' ',20141001, 99991231, 20131120 
    from dual where not exists(select * from SU_EDIT_DETAIL where (EDIT_FUNCTION = ($line."EDIT_FUNCTION") and TABLE_FUNCTION = ($line."TABLE_FUNCTION")
    and CODE_BEGIN= ($line."CODE_BEGIN") 
    and CODE_END= ($line."CODE_END")));
    commit;
    Vijay Patel

    This SQL appears to be Oracle PL/SQL.  You may want to post in the Oracle forum.  If you are habving issues with the ADO.NET objects then you need to supply more of your code.
    ¯\_(ツ)_/¯

  • Release Management vNext Powershell Could not load file or assembly System.Management.Automation Version=3.0.0.0

    Hi,
    I'm running TFS2013.4 with a number of build servers and all working fine. 
    I'm also running Release Management with update 4 (12.0.31101.0) and am running into trouble when trying to run my first dummy release.
    I have setup my servers, stages, releases paths, components and release template (all vNext) with out issue.
    When I run my Release Template (Deploy Using PS/DSC) I'm getting the following error :-
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException:
    Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
    The system cannot find the file specified.
       at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.PowershellExecutor.DisposeCurrentSession()
       at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.Dispose()
       at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.DeploymentClient.<RunAsync>d__11.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.DeploymentClient.<RunPowerShellAsync>d__1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.<CopyBuildsLocally>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.<RunScript>d__0.MoveNext()
       --- End of inner exception stack trace ---
       at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
       at Microsoft.TeamFoundation.Release.MonitorServices.Dsc.OnPrem.OnPremDeploymentActions.InvokePlatform(String activityId, MachineSpecification machineSpecification, StorageSpecification storageSpecification, String scriptPath, String configurationPath,
    Dictionary`2 configurationVariables)
       at Microsoft.TeamFoundation.Release.MonitorServices.Dsc.OnPrem.OnPremDeploymentActions.RunScript(DscComponent dscComponentParameters, String serverName, String userName, String password, String componentName, String scriptPath, String configurationPath,
    String useCredSecuritySupportProvider, String useHttps, String skipCACheck)
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.Dsc.DscComponentInstaller.InvokeMethodByReflection(String methodArguments)
    I can't work out if my target machine (2008 R2 SP1) has a problem with WMA 3.0 or if the Release Template can't find the powershell script that I'm trying to call.  I figured that the relative path to the script could be wrong and have tried numerous
    iterations to no effect.  The error clearly points to a problem with WMA right?
    The target machine has .Net Framework 4.0, WMA Framework 3.0 and I can run Enter-PSSession to remote to it etc...
    Before I trash and rebuild my target machine I hoping someone may have some insight to my problem?
    Thanks in Advance
    Jason
    shroomie

    Daniel,
    The PS Script is taken from an MSDN blog and is fairly standard.  I'm sure it will run fine when executed, but I've not run it as it requires environment variables ($applicationPath) that will be present in the Release Management session calling it. 
    Here's the script :-
    configuration InstallModules
        param
            # Target nodes to apply the configuration
            [string[]]$NodeName = 'localhost',
            # Source Path for Modules
            [String]$SourcePath = "$applicationPath\Deploy\Modules",
            # Destination path for Modules
            [String]$DestinationPath = "$env:ProgramFiles\WindowsPowershell\Modules"
        Node $NodeName
            # Copy the Modules
            File ModuleContent
                Ensure          = "Present"
                SourcePath      = $SourcePath
                DestinationPath = $DestinationPath
                Recurse         = $true
                Type            = "Directory"
    InstallModules
    Thanks
    Jason
    shroomie

  • System::Management::Automation not recognized in cpp code

    I need to call powershell cmdlets from cpp code. The cmdlets which will operate the vm's from the hyper-v.
    I found that to run the powershell cmdlets, will have to create powershell object and then could invoke the scripts I need to.
    But code fails at the line..
    using namespace System::Management::Automation;
    I am using a makefile to build my project.
    What libs, and dll's I need to add so the project will be able to recognize this namespace.

    Hi PuneDev,
    Sorry for the delay.
    If you want to load .dll file in powershell, please refer to the script below:
    [Reflection.Assembly]::LoadFile(“c:\temp\MyMathLib.dll”)
    Reference from:
    Run my third party dll with powershell
    Best Regards,
    Anna

  • System.Management.Automation.ExitException not trapped

    If I ran the following code and click the Exit-Button, I get a
    System.Management.Automation.ExitException.
    $ErrorActionPreference = 'Stop'
    Add-Type -AssemblyName 'System.Windows.Forms'
    $Form = New-Object Windows.Forms.Form
    $Form.Add_Shown({
    $Form.Activate()
    $Button_Exit = New-Object System.Windows.Forms.Button
    $Button_Exit.Text = 'Exit'
    $Form.Controls.Add($Button_Exit)
    $Button_Exit.Add_Click({
    Trap {
    Write-Host 'trapped'
    Exit
    $Form.ShowDialog()
    I found, I can prevent the exception if I use [System.Environment]::Exit(0)
    instead of  Exit.
    My Question is: Why is System.Management.Automation.ExitException
    not trapped?
    The Trap does work with other exceptions.

    Are you trying to only exit the form or are you trying to exit the PowerShell console/ISE? Based on the error that is happening, you won't be able to catch it under PowerShell as it seems to be happening outside of it (yes the error happens because of
    what you are doing in PowerShell, but it is outside of PowerShell's control). I would stick with your workaround to deal with the exit button event.
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • Error: System.Management.Automation.RemoteException: Federation information could not be received from the external organization.

    Greetings.
    I'm getting 2 errors and 1 warning in the Hybrid Configuration object:
    INFO : Session=Tenant Cmdlet=Get-FederationInformation -DomainName 'SanJuanCiudadPatria.com' -BypassAdditionalDomainValidation: $true START
    ERROR : System.Management.Automation.RemoteException: Federation information could not be received from the external organization.
    INFO : Session=Tenant Cmdlet=Get-FederationInformation FINISH Time=2620.7003ms
    INFO : Session=Tenant Cmdlet=Get-FederationInformation -DomainName 'SanJuanCiudadPatria.com' -BypassAdditionalDomainValidation: $true START
    ERROR : System.Management.Automation.RemoteException: Federation information could not be received from the external organization.
    INFO : Session=OnPrem Cmdlet=Get-OrganizationConfig START
    INFO : Session=OnPrem Cmdlet=Get-OrganizationConfig FINISH Time=203.229ms
    WARNING : Office 365 was unable to communicate with your on-premises Autodiscover endpoint.  This is typically due to incorrect DNS or firewall configuration.  The Office 365 tenant is currently configured to use the following URL for Autodiscover
    queries from the Office 365 tenant to the on-premises organization - https://autodiscover.SanJuanCiudadPatria.com/autodiscover/autodiscover.svc/WSSecurity. See the following article for further information: http://go.microsoft.com/fwlink/p/?LinkId=275838
    Any help would be greatly appreciated.
    Hello World.

    Hello,
    If the IIS configuration is missing the svc-Integrated handler mapping, the issue may occur. Please try to refer to the following KB to check if the issue can be solved.
    http://support.microsoft.com/kb/2626696
    Please check if there is A record for autodiscover on public DNS server or DNS SRV record.
    Additional blog for your reference.
    http://blogs.technet.com/b/mikehall/archive/2013/08/21/office-365-insight-into-the-hybrid-configuration-wizard-part-2.aspx
    Cara Chen
    TechNet Community Support

  • System.Management.Automation.Runspaces.Pipeline.Invoke()

    Hi,
    I am trying to stop a windows service on a remote computer using System.Management.Automation.Runspaces.Pipeline.Invoke() method.
    To do this I create a string containing the powershell command ("Get-Service -ComputerName machineName -Name serviceName | Stop-Service") and add it as a parameter to
    pipeline.Commands.AddScript
    However, the service fails to stop.
    Any thooughts ??

    Are you running this under the PowerShell console or ISE? Or is this something you are working on in Visual Studio to  build some other tool that utilizes PowerShell? If through Visual Studio would be great to see all of your code to
    better help you out, otherwise if you are trying to do something through the ISE/Console you should really look at what everyone else has already said.
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • SharePoint Designer 2013 after installation getting error with runtime i.e. error writing to file Microsoft.SharePoint.Client.Runtime.Local.Resources.dll Verify that you have access to that directory

    SharePoint Designer 2013 after installation getting error with runtime i.e. error writing to file Microsoft.SharePoint.Client.Runtime.Local.Resources.dll Verify that you have access to that directory
    after retry..again SharePoint Designer requires the following component require to install Microsoft.NET framework version 4 i have downloaded and try to installed but fail not work please answer what to do?
    Thanks and Regards, Rangnath Mali

    Hi Rangnath,
    For running SharePoint Designer 2013, you need to install Microsoft .NET 4.0 Framework or higher.
    Please uninstall the Microsoft .NET 4.0 Framework, and install it again. After that, reboot your machine.
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • Call function with select arguments

    Hi Gurus,
    I have problem to call function inside select statements as follow:
    select a.ID_ELE2, a.ID_ELE3, a.DT_FIS_YR, c.NU_FIS_PER, c.dt,
    (case
    when c.ld is null then
    GET_LD_CHECK (a.DT_FIS_YR,c.NU_FIS_PER, a.ID_ELE3, a.ID_ELE2) -- 1
    -- GET_LD_CHECK ('2009',7, '8010', '7493') --- 2
    else
    c.ld
    end ) description
    from ACCOUNT a, TRANSACTION c
    where a.DT_FIS_YR ='2009'
    and a.ID_ELE3 <> '0000'
    and c.TY_SRC not in ('CL', 'CN')
    and a.DT_FIS_YR = c.nu_fis_yr
    and a.AK = c.AK_FGCHAR
    and trim(a.ID_ELE3) ='8010'
    and c.NU_FIS_PER <> 14
    order by 1,4,5,6
    the 1 doesn't output result but the 2 it does! How can pass the select result to the function?
    Thanks in advance for your help.
    Ben

    The statement / function call seems to be ok. So there are not much chances left for your call to return different (=non) values.
    1) It could be that you have different values in the column then during your test call.
    2) Maybe your function raises an error and that error is supressed in some ugly WHEN OTHERS EXCEPTION => Solution: Get rid of the error handler.
    3) datatype conversion. For example if a.dt_fis_yr is a number value, then you should test with number values and not with strings. GET_LD_CHECK (2009,7, '8010', '7493'). Same logic goes for the other paramters, make sure the datatype is correct and matches the function parameter.

  • Call apt with multiple arguments

    Is it possible to call apt inside a java class and pass multiple .class files?
    For example:
    String[] args = new String[5];
    args[0] = "-nowarn";
    args[1] = "-XclassesAsDecls";
    args[2] = "-classpath";
    args[3] = System.getProperty("java.class.path");          
    args[4] = "packageName.FirstClass packageName.SecondClass";
    return Main.process(new MyAnnotationProcessorFactory(),args);Result of the above example is:
    error: Could not find class file for packageName.FirstClass packageName.SecondClass
    1 error

    The class path contains classes that we need.
    This example works:
    String[] args = new String[6];
    args[0] = "-nowarn";
    args[1] = "-XclassesAsDecls";
    args[2] = "-classpath";
    args[3] = System.getProperty("java.class.path");     
    args[4] = "packageName.FirstClass";
    args[5] = "packageName.SecondClass";
    return Main.process(new IapiAnnotationProcessorFactory(),args);I replaced args[4] = "packageName.FirstClass packageName.SecondClass"; with a
    args[4] = "packageName.FirstClass";
    args[5] = "packageName.SecondClass";

  • Call method with an argument from another view controller

    I have a UIViewController MainViewController that brings up a modal view that is of the class AddPlayerViewController. When the user clicks 'Save' in the modal view I need to pass the Player data (which is a Player class) from the modal view to the MainViewController in addition to triggering a method in the MainViewController. What's the best way to accomplish this? I'm new to cocoa and have only tried using delegates and some ugly hacks to no avail.
    Thanks for the help.

    If I understand correctly, you have:
    1. A model object, Player.
    2. A top view controller, MainViewController.
    3. Another view controller, AddPlayerViewController, which MainViewController displays modally.
    I'm guessing that AddPlayerViewController creates a new Player object and lets the user set its values, and you need a way to get that new Player into MainViewController once they're done.
    So, here's what I'd do:
    1. Create an AddPlayerViewControllerDelegate protocol. It should declare two methods, "- (void)addPlayerViewController:(AddPlayerViewContrller*)controller didAddPlayer:(Player*)newPlayer" and "- (void)addPlayerViewControllerNotAddingPlayer:(AddPlayerViewController*)controll er".
    2. Add an attribute of type "id <AddPlayerViewControllerDelegate>" called delegate to AddPlayerViewController. Also add a property with "@property (assign)" and "@synthesize".
    3. Modify AddPlayerViewController so that if you click the "Save" button, addPlayerViewController:didAddPlayer: gets called, passing "self" and the new Player object as the two arguments. Also arrange for clicking the "Cancel" button to call addPlayerViewControllerNotAddingPlayer:.
    4. Modify MainViewController to declare that it conforms to AddPlayerViewControllerDelegate. Implement those two methods (addPlayerViewControllerNotAddingPlayer: might be an empty method if you don't want to do anything).
    5. When you create your AddPlayerViewController, set its delegate to your MainViewController.
    If you need more detail, let me know what parts you need me to elaborate on.

  • Calling RH_ShowLocalHelp with 5 arguments

    Hello all,
    I'm trying to make a context-sensitive help call from C#. According to the documentation at http://help.adobe.com/en_US/robohelp/robohtml/WS5b3ccc516d4fbf351e63e3d11aff59c571-7f39.ht ml , there's a function named RH_ShowLocalHelp that takes 5 parameters. Unfortunately, that function seems to be missing from the C# files that ship with RoboHelp 10 (the 4 arguments' version is in the file, though). Am I missing something in here? Am I not using the right files?
    Thanks in advance,
    --Ignacio

    I don't have an answer but maybe a look at www.wvanweelden.eu will help. Willam has a lot of information on calling help.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

Maybe you are looking for