示例#1
0
        private static void PrintField(Field field)
        {
            //Get the SystemMandatory of each Field
            Console.WriteLine("Field SystemMandatory: " + field.SystemMandatory);

            //Get the Webhook of each Field
            Console.WriteLine("Field Webhook: " + field.Webhook);

            //Get the Object obtained Private instance
            Private private1 = field.Private;

            //Check if private is not null
            if (private1 != null)
            {
                //Get the Restricted of the Private
                Console.WriteLine("Field Private Restricted: " + private1.Restricted);

                //Get the Export of the Private
                Console.WriteLine("Field Private Export: " + private1.Export);

                //Get the Type of the Private
                Console.WriteLine("Field Private Type: " + private1.Type);
            }

            //Get the JsonType of each Field
            Console.WriteLine("Field JsonType: " + field.JsonType);

            //Get the Object obtained Crypt instance
            Crypt crypt = field.Crypt;

            //Check if crypt is not null
            if (crypt != null)
            {
                //Get the Mode of the Crypt
                Console.WriteLine("Field Crypt Mode: " + crypt.Mode);

                //Get the Column of the Crypt
                Console.WriteLine("Field Crypt Column: " + crypt.Column);

                List <string> encFldIds = crypt.Encfldids;

                if (encFldIds != null)
                {
                    Console.WriteLine("EncFldIds : ");

                    foreach (string encFldId in encFldIds)
                    {
                        Console.WriteLine(encFldId);
                    }
                }

                //Get the Notify of the Crypt
                Console.WriteLine("Field Crypt Notify: " + crypt.Notify);

                //Get the Table of the Crypt
                Console.WriteLine("Field Crypt Table: " + crypt.Table);

                //Get the Status of the Crypt
                Console.WriteLine("Field Crypt Status: " + crypt.Status);
            }

            //Get the FieldLabel of each Field
            Console.WriteLine("Field FieldLabel: " + field.FieldLabel);

            //Get the Object obtained ToolTip instance
            ToolTip tooltip = field.Tooltip;

            //Check if tooltip is not null
            if (tooltip != null)
            {
                //Get the Name of the ToolTip
                Console.WriteLine("Field ToolTip Name: " + tooltip.Name);

                //Get the Value of the ToolTip
                Console.WriteLine("Field ToolTip Value: " + tooltip.Value);
            }

            //Get the CreatedSource of each Field
            Console.WriteLine("Field CreatedSource: " + field.CreatedSource);

            //Get the Type of each Field
            Console.WriteLine("Field Type: " + field.Type);

            //Get the FieldReadOnly of each Field
            Console.WriteLine("Field FieldReadOnly: " + field.FieldReadOnly);

            //Get the DisplayLabel of each Field
            Console.WriteLine("Field DisplayLabel: " + field.DisplayLabel);

            if (field.DisplayType != null)
            {
                //Get the DisplayType of each Field
                Console.WriteLine("Field DisplayType: " + field.DisplayType.Value);
            }

            //Get the UiType of each Field
            Console.WriteLine("Field UiType: " + field.UiType);

            //Get the ReadOnly of each Field
            Console.WriteLine("Field ReadOnly: " + field.ReadOnly);

            //Get the Object obtained AssociationDetails instance
            AssociationDetails associationDetails = field.AssociationDetails;

            //Check if associationDetails is not null
            if (associationDetails != null)
            {
                //Get the Object obtained LookupField instance
                LookupField lookupField = associationDetails.LookupField;

                //Check if lookupField is not null
                if (lookupField != null)
                {
                    //Get the ID of the LookupField
                    Console.WriteLine("Field AssociationDetails LookupField ID: " + lookupField.Id);

                    //Get the Name of the LookupField
                    Console.WriteLine("Field AssociationDetails LookupField Name: " + lookupField.Name);
                }

                //Get the Object obtained LookupField instance
                LookupField relatedField = associationDetails.RelatedField;

                //Check if relatedField is not null
                if (relatedField != null)
                {
                    //Get the ID of the LookupField
                    Console.WriteLine("Field AssociationDetails RelatedField ID: " + relatedField.Id);

                    //Get the Name of the LookupField
                    Console.WriteLine("Field AssociationDetails RelatedField Name: " + relatedField.Name);
                }
            }

            if (field.QuickSequenceNumber != null)
            {
                //Get the QuickSequenceNumber of each Field
                Console.WriteLine("Field QuickSequenceNumber: " + field.QuickSequenceNumber);
            }

            //Get the BusinesscardSupported of each Field
            Console.WriteLine("Field BusinesscardSupported: " + field.BusinesscardSupported);

            //Get the MultiModuleLookup of each Field
            MultiModuleLookup multiModuleLookup = field.MultiModuleLookup;

            if (multiModuleLookup != null)
            {
                API.Fields.Module module = multiModuleLookup.Module;

                if (module != null)
                {
                    //Get the APIName of MultiModuleLookup Module
                    Console.WriteLine("Field MultiModuleLookup Module APIName: " + module.APIName);

                    //Get the Id of MultiModuleLookup Module
                    Console.WriteLine("Field MultiModuleLookup Module Id: " + module.Id);
                }

                //Get the APIName of MultiModuleLookup
                Console.WriteLine("Field MultiModuleLookup Name: " + multiModuleLookup.Name);

                //Get the Id of MultiModuleLookup
                Console.WriteLine("Field MultiModuleLookup Id: " + multiModuleLookup.Id);
            }

            //Get the Object obtained Currency instance
            Com.Zoho.Crm.API.Fields.Currency currency = field.Currency;

            //Check if currency is not null
            if (currency != null)
            {
                //Get the RoundingOption of the Currency
                Console.WriteLine("Field Currency RoundingOption: " + currency.RoundingOption);

                if (currency.Precision != null)
                {
                    //Get the Precision of the Currency
                    Console.WriteLine("Field Currency Precision: " + currency.Precision);
                }
            }

            //Get the ID of each Field
            Console.WriteLine("Field ID: " + field.Id);

            if (field.CustomField != null)
            {
                //Get the CustomField of each Field
                Console.WriteLine("Field CustomField: " + field.CustomField);
            }

            //Get the Object obtained Module instance
            Module lookup = field.Lookup;

            //Check if lookup is not null
            if (lookup != null)
            {
                //Get the Object obtained Layout instance
                API.Layouts.Layout layout = lookup.Layout;

                //Check if layout is not null
                if (layout != null)
                {
                    //Get the ID of the Layout
                    Console.WriteLine("Field ModuleLookup Layout ID: " + layout.Id);

                    //Get the Name of the Layout
                    Console.WriteLine("Field ModuleLookup Layout Name: " + layout.Name);
                }

                //Get the DisplayLabel of the Module
                Console.WriteLine("Field ModuleLookup DisplayLabel: " + lookup.DisplayLabel);

                //Get the APIName of the Module
                Console.WriteLine("Field ModuleLookup APIName: " + lookup.APIName);

                //Get the Module of the Module
                Console.WriteLine("Field ModuleLookup Module: " + lookup.Module_1);

                if (lookup.Id != null)
                {
                    //Get the ID of the Module
                    Console.WriteLine("Field ModuleLookup ID: " + lookup.Id);
                }

                //Get the ModuleName of the Module
                Console.WriteLine("Field Lookup ModuleName: " + lookup.ModuleName);
            }

            //Get the Filterable of each Field
            Console.WriteLine("Field Filterable: " + field.Filterable);

            if (field.ConvertMapping != null)
            {
                //Get the ConvertMapping of each Field
                Console.WriteLine("Transition Fields ConvertMapping: ");

                //Get the details map
                foreach (KeyValuePair <string, object> entry in field.ConvertMapping)
                {
                    //Get each value in the map
                    Console.WriteLine(entry.Key + " : " + JsonConvert.SerializeObject(entry.Value));
                }
            }

            if (field.Visible != null)
            {
                //Get the Visible of each Field
                Console.WriteLine("Field Visible: " + field.Visible);
            }

            List <API.Profiles.Profile> profiles = field.Profiles;

            if (profiles != null)
            {
                foreach (API.Profiles.Profile profile in profiles)
                {
                    //Get the PermissionType of each Profile
                    Console.WriteLine("Field Profile PermissionType: " + profile.PermissionType);

                    //Get the Name of each Profile
                    Console.WriteLine("Field Profile Name: " + profile.Name);

                    //Get the Id of each Profile
                    Console.WriteLine("Field Profile Id: " + profile.Id);
                }
            }

            if (field.Length != null)
            {
                //Get the Length of each Field
                Console.WriteLine("Field Length: " + field.Length);
            }

            //Get the Object obtained ViewType instance
            ViewType viewType = field.ViewType;

            //Check if viewType is not null
            if (viewType != null)
            {
                //Get the View of the ViewType
                Console.WriteLine("Field ViewType View: " + viewType.View);

                //Get the Edit of the ViewType
                Console.WriteLine("Field ViewType Edit: " + viewType.Edit);

                //Get the Create of the ViewType
                Console.WriteLine("Field ViewType Create: " + viewType.Create);

                //Get the View of the ViewType
                Console.WriteLine("Field ViewType QuickCreate: " + viewType.QuickCreate);
            }

            //Get the PickListValuesSortedLexically of each Field
            Console.WriteLine("Field PickListValuesSortedLexically: " + field.PickListValuesSortedLexically);

            //Get the Sortable of each Field
            Console.WriteLine("Field Sortable: " + field.Sortable);

            //Get the Object obtained Module instance
            Module subform = field.Subform;

            //Check if subform is not null
            if (subform != null)
            {
                //Get the Object obtained Layout instance
                API.Layouts.Layout layout = subform.Layout;

                //Check if layout is not null
                if (layout != null)
                {
                    //Get the ID of the Layout
                    Console.WriteLine("Field Subform Layout ID: " + layout.Id);

                    //Get the Name of the Layout
                    Console.WriteLine("Field Subform Layout Name: " + layout.Name);
                }

                //Get the DisplayLabel of the Module
                Console.WriteLine("Field Subform DisplayLabel: " + subform.DisplayLabel);

                //Get the APIName of the Module
                Console.WriteLine("Field Subform APIName: " + subform.APIName);

                //Get the Module of the Module
                Console.WriteLine("Field Subform Module: " + subform.Module_1);

                if (subform.Id != null)
                {
                    //Get the ID of the Module
                    Console.WriteLine("Field Subform ID: " + subform.Id);
                }
            }

            External external = field.External;

            if (external != null)
            {
                //Get the Show of External
                Console.WriteLine("Field External Show: " + external.Show);

                //Get the Type of External
                Console.WriteLine("Field External Type: " + external.Type);

                //Get the AllowMultipleConfig of External
                Console.WriteLine("Field External AllowMultipleConfig: " + external.AllowMultipleConfig);
            }

            //Get the APIName of each Field
            Console.WriteLine("Field APIName: " + field.APIName);

            //Get the Object obtained Unique instance
            Unique unique = field.Unique;

            //Check if unique is not null
            if (unique != null)
            {
                //Get the Casesensitive of the Unique
                Console.WriteLine("Field Unique Casesensitive in " + unique.Casesensitive);
            }

            if (field.HistoryTracking != null)
            {
                //Get the HistoryTracking of each Field
                Console.WriteLine("Field HistoryTracking: " + field.HistoryTracking);
            }

            //Get the DataType of each Field
            Console.WriteLine("Field DataType: " + field.DataType);

            //Get the Object obtained Formula instance
            Formula formula = field.Formula;

            //Check if foreachmula is not null
            if (formula != null)
            {
                //Get the ReturnType of the Formula
                Console.WriteLine("Field Formula ReturnType in " + formula.ReturnType);

                if (formula.Expression != null)
                {
                    //Get the Expression of the Formula
                    Console.WriteLine("Field Formula Expression in " + formula.Expression);
                }
            }

            if (field.DecimalPlace != null)
            {
                //Get the DecimalPlace of each Field
                Console.WriteLine("Field DecimalPlace: " + field.DecimalPlace);
            }

            //Get the MassUpdate of each Field
            Console.WriteLine("Field MassUpdate: " + field.MassUpdate);

            if (field.BlueprintSupported != null)
            {
                //Get the BlueprintSupported of each Field
                Console.WriteLine("Field BlueprintSupported: " + field.BlueprintSupported);
            }

            //Get all entries from the MultiSelectLookup instance
            MultiSelectLookup multiSelectLookup = field.Multiselectlookup;

            //Check if foreachmula is not null
            if (multiSelectLookup != null)
            {
                //Get the DisplayValue of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup DisplayLabel: " + multiSelectLookup.DisplayLabel);

                //Get the LinkingModule of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup LinkingModule: " + multiSelectLookup.LinkingModule);

                //Get the LookupApiname of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup LookupApiname: " + multiSelectLookup.LookupApiname);

                //Get the APIName of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup APIName: " + multiSelectLookup.APIName);

                //Get the ConnectedlookupApiname of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup ConnectedlookupApiname: " + multiSelectLookup.ConnectedlookupApiname);

                //Get the ID of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup ID: " + multiSelectLookup.Id);
            }

            //Get the PickListValue of each Field
            List <PickListValue> pickListValues = field.PickListValues;

            //Check if foreachmula is not null
            if (pickListValues != null)
            {
                foreach (PickListValue pickListValue in pickListValues)
                {
                    PrintPickListValue(pickListValue);
                }
            }

            //Get the AutoNumber of each Field
            AutoNumber autoNumber = field.AutoNumber;

            //Check if foreachmula is not null
            if (autoNumber != null)
            {
                //Get the Prefix of the AutoNumber
                Console.WriteLine("Field AutoNumber Prefix: " + autoNumber.Prefix);

                //Get the Suffix of the AutoNumber
                Console.WriteLine("Field AutoNumber Suffix: " + autoNumber.Suffix);

                if (autoNumber.StartNumber != null)
                {
                    //Get the StartNumber of the AutoNumber
                    Console.WriteLine("Field AutoNumber StartNumber: " + autoNumber.StartNumber);
                }
            }

            if (field.DefaultValue != null)
            {
                //Get the DefaultValue of each Field
                Console.WriteLine("Field DefaultValue: " + field.DefaultValue);
            }

            //Check if ValidationRule is not null
            if (field.ValidationRule != null)
            {
                //Get the details map
                foreach (KeyValuePair <string, Object> entry in field.ValidationRule)
                {
                    //Get each value in the map
                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                }
            }
        }
示例#2
0
        public static void GetWizards()
        {
            //Get instance of WizardsOperations Class
            WizardsOperations wizardsOperations = new WizardsOperations();

            //Call GetWizards method
            APIResponse <ResponseHandler> response = wizardsOperations.GetWizards();

            if (response != null)
            {
                //Get the status code from response
                Console.WriteLine("Status Code: " + response.StatusCode);

                if (new List <int>()
                {
                    204, 304
                }.Contains(response.StatusCode))
                {
                    Console.WriteLine(response.StatusCode == 204 ? "No Content" : "Not Modified");

                    return;
                }

                //Check if expected response is received
                if (response.IsExpected)
                {
                    //Get object from response
                    ResponseHandler responseHandler = response.Object;

                    if (responseHandler is ResponseWrapper)
                    {
                        //Get the received ResponseWrapper instance
                        ResponseWrapper responseWrapper = (ResponseWrapper)responseHandler;

                        //Get the list of obtained Wizard instances
                        List <API.Wizards.Wizard> wizards = responseWrapper.Wizards;

                        foreach (API.Wizards.Wizard wizard in wizards)
                        {
                            //Get the CreatedTime of each Wizard
                            Console.WriteLine("Wizard CreatedTime: " + wizard.CreatedTime);

                            //Get the PermissionType of each Wizard
                            Console.WriteLine("Wizard ModifiedTime: " + wizard.ModifiedTime);

                            //Get the manager User instance of each Wizard
                            API.Modules.Module module = wizard.Module;

                            //Check if manager is not null
                            if (module != null)
                            {
                                //Get the Name of the Manager
                                Console.WriteLine("Wizard Module APIName: " + module.APIName);

                                //Get the ID of the Manager
                                Console.WriteLine("Wizard Module Id: " + module.Id);
                            }

                            //Get the Name of each Wizard
                            Console.WriteLine("Wizard Name: " + wizard.Name);

                            //Get the modifiedBy User instance of each Wizard
                            API.Users.User modifiedBy = wizard.ModifiedBy;

                            //Check if modifiedBy is not null
                            if (modifiedBy != null)
                            {
                                //Get the Name of the modifiedBy User
                                Console.WriteLine("Wizard Modified By User-Name: " + modifiedBy.Name);

                                //Get the ID of the modifiedBy User
                                Console.WriteLine("Wizard Modified By User-ID: " + modifiedBy.Id);
                            }

                            //Get the array of Profile instance each Wizard
                            List <API.Profiles.Profile> profiles = wizard.Profiles;

                            //Check if profiles is not null
                            if (profiles != null)
                            {
                                foreach (API.Profiles.Profile profile in profiles)
                                {
                                    //Get the Name of each Profile
                                    Console.WriteLine("Wizard Profile Name: " + profile.Name);

                                    //Get the ID of each Profile
                                    Console.WriteLine("Wizard Profile ID: " + profile.Id);
                                }
                            }

                            //Get the Active of each Wizard
                            Console.WriteLine("Wizard Active: " + wizard.Active);

                            //Get the array of Container instance each Wizard
                            List <API.Wizards.Container> containers = wizard.Containers;

                            //Check if containers is not null
                            if (containers != null)
                            {
                                foreach (API.Wizards.Container container in containers)
                                {
                                    //Get the array of Layout instance each Wizard
                                    API.Layouts.Layout layout = container.Layout;

                                    //Check if layout is not null
                                    if (layout != null)
                                    {
                                        //Get the Name of Layout
                                        Console.WriteLine("Wizard Container Layout Name: " + layout.Name);

                                        //Get the ID of Layout
                                        Console.WriteLine("Wizard Container Layout ID: " + layout.Id);
                                    }

                                    //Get the ID of each Container
                                    Console.WriteLine("Wizard Container ID: " + container.Id);
                                }
                            }

                            //Get the ID of each Wizard
                            Console.WriteLine("Wizard ID: " + wizard.Id);

                            //Get the createdBy User instance of each Wizard
                            User createdBy = wizard.CreatedBy;

                            //Check if createdBy is not null
                            if (createdBy != null)
                            {
                                //Get the Name of the createdBy Wizard
                                Console.WriteLine("Wizard Created By User-Name: " + createdBy.Name);

                                //Get the ID of the createdBy Wizard
                                Console.WriteLine("Wizard Created By User-ID: " + createdBy.Id);
                            }
                        }
                    }
                    //Check if the request returned an exception
                    else if (responseHandler is APIException)
                    {
                        //Get the received APIException instance
                        APIException exception = (APIException)responseHandler;

                        //Get the Status
                        Console.WriteLine("Status: " + exception.Status.Value);

                        //Get the Code
                        Console.WriteLine("Code: " + exception.Code.Value);

                        Console.WriteLine("Details: ");

                        //Get the details map
                        foreach (KeyValuePair <string, object> entry in exception.Details)
                        {
                            //Get each value in the map
                            Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                        }

                        //Get the Message
                        Console.WriteLine("Message: " + exception.Message.Value);
                    }
                }
                else
                { //If response is not as expected
                    //Get model object from response
                    Model responseObject = response.Model;

                    //Get the response object's class
                    Type type = responseObject.GetType();

                    //Get all declared fields of the response class
                    Console.WriteLine("Type is: {0}", type.Name);

                    PropertyInfo[] props = type.GetProperties();

                    Console.WriteLine("Properties (N = {0}):", props.Length);

                    foreach (var prop in props)
                    {
                        if (prop.GetIndexParameters().Length == 0)
                        {
                            Console.WriteLine("{0} ({1}) in {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject));
                        }
                        else
                        {
                            Console.WriteLine("{0} ({1}) in <Indexed>", prop.Name, prop.PropertyType.Name);
                        }
                    }
                }
            }
        }