Windows form open url

Практическое руководство. Создание связи с объектом или веб-страницей с помощью элемента управления LinkLabel в Windows Forms How to: Link to an Object or Web Page with the Windows Forms LinkLabel Control

LinkLabelЭлемент управления Windows Forms позволяет создавать веб-ссылки в форме. The Windows Forms LinkLabel control allows you to create Web-style links on your form. При нажатии ссылки можно изменить ее цвет, чтобы показать, что ссылка была посещена. When the link is clicked, you can change its color to indicate the link has been visited. Дополнительные сведения об изменении цвета см. в разделе как изменить внешний вид элемента управления LinkLabel Windows Forms. For more information on changing the color, see How to: Change the Appearance of the Windows Forms LinkLabel Control.

Связывание с другой формой Linking to Another Form

Связывание с другой формой с помощью элемента управления LinkLabel To link to another form with a LinkLabel control

Задайте Text для свойства соответствующий заголовок. Set the Text property to an appropriate caption.

Задайте LinkArea свойство, чтобы определить, какая часть заголовка будет указана как ссылка. Set the LinkArea property to determine which part of the caption will be indicated as a link. Способ его указания зависит от свойств метки ссылки, связанных с внешним видом. How it is indicated depends on the appearance-related properties of the link label. LinkAreaЗначение представлено LinkArea объектом, содержащим два числа, начальную и символьную позиции. The LinkArea value is represented by a LinkArea object containing two numbers, the starting character position and the number of characters. LinkAreaСвойство можно задать в окно свойств или в коде следующим образом: The LinkArea property can be set in the Properties window or in code in a manner similar to the following:

В LinkClicked обработчике событий вызовите Show метод, чтобы открыть другую форму в проекте, и присвойте LinkVisited свойству значение true . In the LinkClicked event handler, invoke the Show method to open another form in the project, and set the LinkVisited property to true .

Экземпляр LinkLabelLinkClickedEventArgs класса несет ссылку на LinkLabel элемент управления, который был нажат, поэтому нет необходимости приводить sender объект. An instance of the LinkLabelLinkClickedEventArgs class carries a reference to the LinkLabel control that was clicked, so there is no need to cast the sender object.

Связывание с веб-страницей Linking to a Web Page

LinkLabelЭлемент управления также может использоваться для показа веб-страницы с помощью браузера по умолчанию. The LinkLabel control can also be used to display a Web page with the default browser.

Запуск Internet Explorer и связывание с веб-страницей с помощью элемента управления LinkLabel To start Internet Explorer and link to a Web page with a LinkLabel control

Задайте Text для свойства соответствующий заголовок. Set the Text property to an appropriate caption.

Задайте LinkArea свойство, чтобы определить, какая часть заголовка будет указана как ссылка. Set the LinkArea property to determine which part of the caption will be indicated as a link.

Читайте также:  Whonix для windows 10

Open forms, views, dialogs, and reports with a URL

URL addressable elements enable you to include links to Dynamics 365 for Customer Engagement forms, views, dialogs, and reports in other applications. In this manner, you can easily extend other applications, reports, or websites so that users can view information and perform actions without switching applications.

  • URL addressable forms, views, dialogs, and reports cannot bypass Dynamics 365 for Customer Engagement security. Only licensed Dynamics 365 for Customer Engagement users, based on their security roles, can access the data and the records they see.
    • Use Xrm.Navigation. openForm when you open entity forms programmatically within the application by using web resources. Do not use window.open .
    • Outside the application, where pages do not have access to the Xrm.Navigation. openForm function, use window.open or a link to open a specific record or form for an entity.

URL Addressable Forms and Views

All entity forms and views are displayed in the main.aspx page. Query string parameters passed to this page control what will be displayed. For example:

To open a new account entity record form for on-premises Dynamics 365 for Customer Engagement:

To open an account entity record form for Dynamics 365 for Customer Engagement where the id is <91330924-802a-4b0d-a900-34fd9d790829>:

To open the Closed Opportunities view for Dynamics 365 for Customer Engagement:

To open the Active Contacts view for Dynamics 365 for Customer Engagement with no navigation bar or command bar

Opening entity forms in a dialog window by using showModalDialog or showModelessDialog is not supported.

Displaying an entity form within an IFrame embedded in another entity form is not supported.

You will typically use the getClientUrl method to retrieve the organization root Url for both on-premises Dynamics 365 for Customer Engagement and Dynamics 365 for Customer Engagement.

Query String Parameters for the Main.aspx Page

To get the id value for any record, use the Send a Link button the command bar. The following is an example of what will be opened in your email application:

The id parameter passed to the URL is the encoded id value for the record. In this example the id value is <899d4fcf-f4d3-e011-9d26-00155dba3819>. The encoded version of the GUID substitutes opening and closing brackets “<” and “>” with “%7B” and “%7D”, respectively,

The following are the query string parameters used with the main.aspx page to open entity forms or views:

Parameter Description
etn The logical name of the entity. Important: Do not use the etc (entity type code) parameter that contains an integer code for the entity. This integer code varies for custom entities in different organizations.
extraqs Optional for forms. This parameter contains encoded parameters within this parameter.

Use this parameter to pass values to a form. For more information, see Set field values using parameters passed to a form.

When an entity has more than one form defined, you can use this parameter to specify which form to open by passing the encoded parameter formid with the value equal to the ID value of the form. For example, to open a form with the ID of ‘6009c1fe-ae99-4a41-a59f-a6f1cf8b9daf’, include this value in the extraqs parameter: formid%3D6009c1fe-ae99-4a41-a59f-a6f1cf8b9daf%0D%0A .

pagetype The type of page. There are two possible values:

entityrecord
Displays an entity record form.
entitylist
Displays an entity view.

id Optional for forms. Use this when you open a specific entity record. Pass in the encoded GUID identifier for the entity. The encoded version of the GUID substitutes opening and closing brackets “<“ and “>” with “%7B” and “%7D”, respectively, for example <91330924-802a-4b0d-a900-34fd9d790829>is %7B91330924-802A-4B0D-A900-34FD9D790829%7D .
viewid Required for views. This is the ID of the savedquery or userquery entity record that defines the view. The easiest way to get the URL for a view is to copy it. For more information, see Copy the URL for a View.
viewtype Defines the view type. Possible values are as follows:

1039
Use for a system view. The viewid represents the Id of a savedquery record.
4230
Use for a personal view. The viewid represents the Id of a userquery record.

navbar Controls whether the navigation bar is displayed and whether application navigation is available using the areas and subareas defined in the sitemap.

— on
The navigation bar is displayed. This is the default behavior if the navbar parameter is not used.
— off
The navigation bar is not displayed. People can navigate using other user interface elements or the back and forward buttons.
— entity
On an entity form, only the navigation options for related entities are available. After navigating to a related entity, a back button is displayed in the navigation bar to allow returning to the original record.

cmdbar Controls whether the command bar is displayed. Note: This capability supports requirements for the Unified Service Desk for Dynamics 365 application. Using this to display an entity form within an IFrame embedded in another entity form is not supported.

— true
The command bar is displayed. This is the default.
— false
The command bar is hidden.

Copy the URL for a View

Many views in Dynamics 365 for Customer Engagement let a user copy the URL for a particular view or send an email with the URL for a particular view embedded in the message. This feature makes communication between users easier, and exposes a way for you to gain access to a URL for a view that users can include in another application, such as a SharePoint site.

Do not use this URL to include the view in application navigation using the site map. For more information, see Display a View in the Application Navigation using the Site Map.

The page displayed by the URL includes the full view. This includes the ribbon, but does not include the application navigation.

Get the URL for a View

Open the view you want to use.

On the command bar, click Send a Link, and then click Of Current View.

Paste the link into Notepad and edit it to extract only the URL part of the text that you want.

  • Views that use the user context as a parameter, such as My Accounts, cannot be copied.
    • The GUID that represents system views for system entities will be the same for each on-premises Dynamics 365 for Customer Engagement installation. The GUID for custom entities and custom views will be unique for each Dynamics 365 for Customer Engagement installation.

Display a View in the Application Navigation using the Site Map

When you customize the application navigation using the site map, do not use the view URL that you copied from the application using the steps in Copy the URL for a View to set as the URL. That URL displays a page that includes the ribbon and produces undesirable results if used in a Url attribute.

To display a list of entity records within the application for a SubArea set the Entity attribute value. This displays the default view for that entity and provides the correct title and icon.

However, if you want to have a SubArea element that uses a specific initial default view, use the following Url pattern when working with the Unified Interface.

For the legacy web client, use the following URL.

When you use this URL, you must also specify appropriate values for and , and specify an icon for the entity.

If you specify the view using the . /homepage.aspx page, the view selector will still be shown. If the user changes the view, Dynamics 365 for Customer Engagement remembers the user’s most recent selection and the initial default view displays after they close and re-open their browser.

Opening a Dialog Process by using a URL

A common customization is to enable a user to open a specific dialog process in the context of a specific record. For example, you might want to add a custom button to the ribbon for a specific entity using the id value for current record as an input parameter for the dialog process.

To open a dialog you need the following:

The unique identifier for the dialog.

The logical name for the entity the dialog is created for.

The unique identifier for the record you want to have the dialog run against.

To get the unique identifier for the dialog, navigate to Settings, in the default solution select Processes. Select a process and then in the Actions options on the command bar, click Copy a Link. This will copy a link to edit the dialog to your clipboard, for example, [organization url] /sfa/workflow/edit.aspx?id=%7b6A6E93C9-1FE6-4C07-91A9-E0E2A7C70976%7d .

The following sample shows the URL and query string parameters to open a dialog:

For example, to open the dialog with with the account record use the URL in the following example.

For browsers other than Internet Explorer, if a dialog process is opened from a link, the Finish button may not work. The data will be saved, but the user will need to click the Close button on the window to close it. This is because other browsers do not provide a window.close method if the window is not opened using JavaScript from another window. When possible, use JavaScript and the window.open method to open dialog processes rather than simply providing links.

You can create a JavaScript function to open the dialog as shown in the following example:

Opening a Report by using a URL

You can open a report by passing appropriate parameter values to the following URL: [organization url]/crmreports/viewer/viewer.aspx .

This URL accepts the following parameters:

action
Two possible values for this parameter are run or filter . When run is used, the report will be displayed using the default filters. When filter is used, the report will display a filter that the user can edit before choosing the Run Report button to view the report.

helpID
This parameter is optional. For reports that are included with Dynamics 365 for Customer Engagement the value in this parameter allows the Help button to display appropriate content about this report when Help on This Page is chosen. The value should correspond to the report FileName attribute value.

id
This parameter is the report ReportId attribute value.

The following examples show URLs that can be used to open reports in Dynamics 365 for Customer Engagement.

Open the Neglected Cases report using the default filter:

Open the Top Knowledge Base Articles report and prompt the user to set filter values:

The following function shows how to properly encode values in the URL:

See also

Can you tell us about your documentation language preferences? Take a short survey.

The survey will take about seven minutes. No personal data is collected (privacy statement).

Читайте также:  Fedora security spin linux
Оцените статью