1 / 21

SharePoint-hosted app

SharePoint-hosted app. Alexander Krupsky Artur Kukharevich. Содержание. Вариант SharePoint-hosted app Проблемы Шаблоны сайтов Cross-domain calls Localization Выводы. Вариант SharePoint-hosted app. Запрос на отпуск. Необходимо: Реализовать простой процесс

Télécharger la présentation

SharePoint-hosted app

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SharePoint-hosted app • Alexander Krupsky • Artur Kukharevich

  2. Содержание. • Вариант SharePoint-hosted app • Проблемы • Шаблоны сайтов • Cross-domain calls • Localization • Выводы

  3. Вариант SharePoint-hosted app Запрос на отпуск. Необходимо: • Реализовать простой процесс • Вывести данные на временную линию • Возможность создания заявки должна быть на любой странице сайта

  4. Проблемы. Права Установка прав на элемент списка • Workflow не поддерживает(не актуально) • Нет Event Receiver • Переопределение момента сохранения через JS не возможно при наличии прикрепленных файлов

  5. Проблемы. Права Фиг с ним с элементом. Как установить изначальные права насайте app и установить изначальные настройки? Что говорит по этому поводу MSDN: In some cases, the app will require certain information or choices to be provided before the app can function. When your app requires information before it can function, you should provide a user experience that guides the user to the settings page to update the configuration. You should add the settings page URL to the app’s top-right menu if appropriate so that users can find it easily. If your app has a getting started experience or other settings, you can add those also. For more information, see How to: Use the client chrome control in apps for SharePoint.

  6. Проблемы. Календарь Я хочу чтобы у меня отпуск был каждый месяц по два дня, выпадающих на первую неделю в течении двух лет. Если список находится не на сайте app, то сочувствую, т к SharePoint API позволяет сделать повторяющиеся события: • Серверный код • Запрос к сервису с установкой Date Overlap

  7. Проблемы. Client Web Parts Ограничения: • Встраивается на страницу при помощи iFrame • Фиксированный размер

  8. Проблемы. Client Web Parts Изменения размера iframe varresizeMessage = '<message senderId={Sender_ID}>resize({Width}, {Height})</message>'; resizeMessage= resizeMessage.replace("{Sender_ID}", senderId); resizeMessage= resizeMessage.replace("{Height}", newHeight); resizeMessage= resizeMessage.replace("{Width}", newWidth); window.parent.postMessage(resizeMessage, "*"); Где SenderId –параметр, который берется с query string. Важно!!! Этот метод работает, когда для Client Web Part задана автоматическая ширина и(или) высота.

  9. Проблемы. Workflow Скрытые активности Как локализовать workflow?

  10. Шаблоны сайтов Возможно, но используйте с умом, а лучше вообще не используйте) Что говорит по этому поводу MSDN: Do not use the WebTemplate element in the app manifest to designate any of the built-in SharePoint site definition configurations as the app web's site type. We do not support using any of the built-in site definition configurations, other than APP#0, for app webs.

  11. Cross-domain calls Using REST (работает через AppWebProxy.aspx): $.getScript(scriptbase + "SP.RequestExecutor.js", execCrossDomainRequest); function execCrossDomainRequest() { varexecutor; executor = new SP.RequestExecutor(appweburl); executor.executeAsync( { url: appweburl + "/_api/SP.AppContextSite(@target)/web/title?@target='" + hostweburl + "'", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: successHandler, error: errorHandler } ); }

  12. Cross-domain calls. Architecture

  13. Cross-domain calls Using REST (не используетAppWebProxy.aspx): varcontext = new SP.ClientContext(_appweburl); varfactory = new SP.ProxyWebRequestExecutorFactory(_appweburl); context.set_webRequestExecutorFactory(factory); varappContextSite = new SP.AppContextSite(context, _hostweburl); // наш запрос context.executeQueryAsync(); Пример запроса: <Requestxmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"SchemaVersion="15.0.0.0"LibraryVersion="16.0.0.0"ApplicationName="Javascript Library"> <Actions> <ObjectPathId="69"ObjectPathId="68" /> </Actions> <ObjectPaths> <ConstructorId="68"TypeId="{5530f782-6a0d-41ec-bfd9-2cb628fe1557}"> <Parameters> <ParameterType="String">https://spsitepro.sharepoint.com/sites/apps</Parameter> </Parameters> </Constructor> </ObjectPaths> </Request>

  14. Localization. С чего начать А начинается все безобидно) В настройках AppManifestуказываем поддерживаемые языки и Visual Studio автоматически сгенерирует необходимые ресурсные файлы.

  15. Localization. Вконтексте App Web Для локализации модулей(Lists, ContentTypesи т.п.), которые будут доступны только на App Webнеобходимо использовать стандартную конструкцию: $Resources:Resource_key;

  16. Localization. В контексте Hosted-Web Может применяться для локализации App Client Web Part, Ribbon Actions. Используем: $Resources:Resource_key; Получаем:

  17. Localization. В контексте Hosted-Web Вот так Microsoft описывает проблему: To add OPC relationship markup to the app package • Append a .zip extension to the app package. • In the .zip file, open the folder named _rels. • Open the AppManifest.xml.rels file. This file specifies the OPC relationships of the AppManifest.xml file to other files in the package. The file contains a Relationship element for the Resources.resx file and for each of the Resources.LL-CC.resx files. The following are examples: <Relationship Type="http://schemas.microsoft.com/sharepoint/2012/app/relationships/content-defaultresource" Target="/Resources.resx" Id="R8d5c4429fc13446e" /> <Relationship Type="http://schemas.microsoft.com/sharepoint/2012/app/relationships/content-resource" Target="/Resources.en-US.resx" Id="R71986f3a45e24d8f" /> • Copy these resource-related Relationship elements and save them in a text file outside the package so you can reuse them in a later step. • Close the AppManifest.xml.rels file. • In the _rels folder, open the featureGUID.xml.rels file. This file specifies the OPC relationships of the featureGUID.xml file and all its child files, such as elements.xml files, to other files in the package. • Paste into the Relationships element all of the Relationship elements that you copied from the AppManifest.xml.rels file. It’s OK to use the same relationship IDs because you are pasting them into a different parent Relationships element. • Save (as UTF-8) and close the file. • Close the .zip file and then remove the ".zip" from the end of the file name. The app package can now be installed on your test SharePoint website.

  18. Localization. В контексте Hosted-Web Скачать с Msdnутилиту AddRelsToAppPackage (http://msdn.microsoft.com/en-us/library/fp179919.aspx) СПОСОБ РАБОТАЕТ ТОЛЬКО ПРИ Deploy!!!!!

  19. Localization. В контексте Hosted-Web Сделаем, что бы работало при deploy и publish. В .csprojфайл добавить следующее: <TargetName="ConfigureResourses"AfterTargets="PackageSharePointApp"> <ExecCommand="$(SolutionDir)ConfigureRelsToAppPackage.exe $(TargetDir)"ContinueOnError="false"></Exec> </Target> после строки: <ImportProject="$(VSToolsPath)\SharePointTools\Microsoft.VisualStudio.SharePoint.targets"Condition="'$(VSToolsPath)' != ''"/>

  20. Localization. UI А как же быть с alert и ему подобным???

  21. Выводы А выводы делайте сами ;)

More Related