Mostrando postagens com marcador Workflow Manager. Mostrar todas as postagens
Mostrando postagens com marcador Workflow Manager. Mostrar todas as postagens

quarta-feira, 30 de dezembro de 2015

SharePoint 2013: ScopeNotFoundException: Workflow publicado não é exibido


O evento abaixo ocorre, se o (sub)escopo do subsite no Workflow Manager não foi criado. Isso pode ocorrer após a importação de um subsite.

Maiores detalhes sobre o escopo do fluxo de trabalho:
"A scope is a named and securable container for Activities, Workflows, Instances, configuration and child Scopes.. It also provides a boundary for multi-tenancy and messaging (notifications). Scopes can be created and modified using the Workflow Client API. It is represented in the Client API by the T:Microsoft.Workflow.Client.ScopeInfo class."

Evento no log do SharePoint:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Microsoft.Workflow.Client.ScopeNotFoundException: Scope '/SharePoint/default/<site collection GUID>/<subsite GUID>' was not found. HTTP headers received from the server - ActivityId: <GUID>. NodeId: <Server name>. Scope: /SharePoint/default/<site collection GUID>/<subsite GUID>. Client ActivityId : <GUID>. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.Workflow.Client.HttpGetResponseAsyncResult`1.End(IAsyncResult result)
at Microsoft.Workflow.Client.ClientHelpers.SendRequest[T](HttpWebRequest request, T content) -
-- End of inner exception stack trace ---
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Solução:

Execute os dois comandos abaixo para desabilitar e habilitar o feature oculto "WorkflowServiceStore" para forçar a cria do escopo, em seguida publique os fluxos de trabalhos.
1. Disable-SPFeature WorkflowServiceStore -Url <endereço do subsite>
2. Enable-SPFeature WorkflowServiceStore -Url <endereço do subsite>

quinta-feira, 22 de outubro de 2015

SharePoint 2013 - Workflow suspenso: HTTP 401 You do not have permission to perform this action or access this resource.


O fluxo de trabalho no SharePoint 2013 fica normalmente no estado suspenso com a mensagem de erro "
You do not have permission to perform this action or access this resource." se o fluxo está configurado para enviar e-mail(s) e para iniciar automaticamente.

Mensagem de erro no interface:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
RequestorId: <GUID>. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ApplicationException: HTTP 401 {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}} {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPRequestGuid":["<GUID>"],"request-id":["<GUID>"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"MicrosoftSharePointTeamServices":["15.0.0.4675"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Cache-Control":["max-age=0, private"],"Date":["<DATE>"],"Set-Cookie":["WSS_KeepSessionAuthenticated={<GUID>}; path=\/"],"Server":["Microsoft-IIS\/7.5"],"WWW-Authenticate":["NTLM"],"X-AspNet-Version":["4.0.30319"],"X-Powered-By":["ASP.NET"]} at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mensagem de error no log do SharePoint:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
It’s app only request, but the app <identity> is not allowed to use app only policy.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


Solução: Ativar o feature “Workflows can use app permissions” na página OU desativar e ativar o feature novamente.

[]

quarta-feira, 18 de fevereiro de 2015

SharePoint 2013 - Workflow suspenso: HTTP 401: "An unhandled exception occurred during the execution of the workflow instance."




O fluxo de trabalho no SharePoint 2013 fica normalmente no estado suspenso com a mensagem de erro "An unhandled exception occurred during the execution of the workflow instance." para os usuários da FBA (usuários de declarações) devido a falta de mapeamento da propriedade "SPS-UserPrincipalName" com a propriedade "sAMAccountName".

Isso é "by design" devido a utilização do protocolo OAuth, utilizado na comunicação entre o Workflow Manager e o SharePoint, porque os tokens OAuth contém apenas o UPN por razões de segurança. 
O SharePoint utiliza essa informação (o UPN) para obter mais detalhes sobre o usuário no serviço "User Profile Service Application".

Resumindo: Os fluxos de trabalho do SharePoint 2013 requerem o serviço "User Profile Service Application" e das informações nele.

Mensagem de erro no interface::

RequestorId: <GUID>. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ApplicationException: HTTP 401 {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPClientServiceRequestDuration":["50"],"SPRequestGuid":["<GUID>"],"request-id":["<GUID>"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"MicrosoftSharePointTeamServices":["15.0.0.4569"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],[...]


Mensagem de error nos logs do SharePoint:

Problem getting output claims identity. Exception: 'Microsoft.Office.Server.Security.UserProfileNoUserFoundException: 3001002;reason=The incoming identity is not mapped to any user profile account in SharePoint. Possible cause is that no user profiles are created in user profile database. Contact your administrator.     at Microsoft.Office.Server.Security.UserProfileIdentityClaimMapper.GetSingleUserProfileFromClaimsList(UserProfileManager upManager, IEnumerable`1 identityClaims)     at Microsoft.Office.Server.Security.UserProfileIdentityClaimMapper.<>


Solução:

1. Abre a propriedade "SPS-UserPrincipalName" (User Principal Name) no serviço de aplicação "User Profile Service Application".

2. Configure o mapeamento (direção import).


3. Execute a sincronização do User Profile (full).

SharePoint 2013 User Profile Sync for Claims Users

[]

segunda-feira, 16 de fevereiro de 2015

SharePoint 2013 - Workflow cancelado: HTTP 401 "There has been an error authenticating the request"


O fluxo de trabalho no SharePoint 2013 fica normalmente no estado cancelado com a mensagem de erro "There has been an error authenticating the request" se o usuário que iniciou o fluxo não possui um perfil no serviço de aplicação "User Profile Service Application".

Isso é "by design" devido a utilização do protocolo OAuth, utilizado na comunicação entre o Workflow Manager e o SharePoint, porque os tokens OAuth contém apenas o UPN (User Principal Name) por razões de segurança. 

O SharePoint utiliza essa informação (o UPN) para obter mais detalhes sobre o usuário no serviço "User Profile Service Application".

Resumindo: Os fluxos de trabalho do SharePoint 2013 requerem o serviço "User Profile Service Application" e das informações nele.



Mensagem de erro no interface:


RequestorId: <GUID>. Details: System.ApplicationException: HTTP 401 {“x-ms-diagnostics”:[“3001000;reason=\”There has been an error authenticating the request.\”;category=\”invalid_client\””],”SPRequestGuid”:[“<GUID>″],”request-id”:[“<GUID>″],”X-FRAME-OPTIONS”:[“SAMEORIGIN”],”SPRequestDuration”:[“61″],”SPIisLatency”:[“1″],”Server”:[“Microsoft-IIS\/8.0″],”WWW-Authenticate” [...]

Mensagens de error nos logs do SharePoint:



SPApplicationAuthenticationModule: Error authenticating request, Error details { Header: {0}, Body: {1} }. Available parameters: 3001000;reason="There has been an error authenticating the request.";category="invalid_client" {"error_description":"The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs."} .               \
The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.   at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.ReadResponse(Message response)     at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst, RequestSecurityTokenResponse& rstr)   
SharePoint 2013 e OAuth - Uma visão geral

 []

quinta-feira, 20 de novembro de 2014

SharePoint 2013 - Workflow suspenso: HTTP 401 Invalid JWT token



O fluxo de trabalho no SharePoint 2013 fica normalmente no estado suspenso com a mensagem de erro "HTTP 401 Invalid JWT token. Could not resolve issuer token." após a re-instalação do Workflow Manager. A causa é um token de autenticação (S2S - server to server autentication) inválido.

Mensagem de erro no interface:
An unhandled exception occurred during the execution of the workflow instance. Exception details: HTTP 401 {"error_descritption":Invalid JWT token. Could not resolve issuer token."}
Mensagem de error nos logs do SharePoint:

Application Authentication    High    SPApplicationAuthenticationModule: Invalid token or signature. Exception: System.IdentityModel.Tokens.SecurityTokenException: Invalid JWT token. Could not resolve issuer token.     at Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.ReadTokenCore(String token, Boolean isActorToken)     at Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.ReadActor(IDictionary`2 payload)     at Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.ReadTokenCore(String token, Boolean isActorToken)     at Microsoft.SharePoint.IdentityModel.SPApplicationAuthenticationModule.TryExtractAndValidateToken(HttpContext httpContext, SPIncomingTokenContext& tokenContext)
SharePoint Foundation    Application Authentication    High    SPApplicationAuthenticationModule: Error authenticating request, Error details: Header: 3000006;reason="Token contains invalid signature.";category="invalid_client", Body: {"error_description":"Invalid JWT token. Could not resolve issuer token."}
SharePoint Foundation    General    Medium    Application error when access _vti_bin/client.svc, Error=Invalid JWT token. Could not resolve issuer token.   at Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.ReadTokenCore(String token, Boolean isActorToken)     at Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.ReadActor(IDictionary`2 payload)     at Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.ReadTokenCore(String token, Boolean isActorToken)     at Microsoft.SharePoint.IdentityModel.SPApplicationAuthenticationModule.TryExtractAndValidateToken(HttpContext httpContext, SPIncomingTokenContext& tokenContext)

Solução:

Execute o timer job "Refresh Trusted Security Token Services Metadata feed" do SharePoint utilizando Powershell (Start-SPTimerJob RefreshMetadataFeed) ou na interface.

[]

quinta-feira, 16 de outubro de 2014

SharePoint 2013 - Workflow suspenso: System.ApplicationException: HTTP 401



O fluxo de trabalho no SharePoint 2013 fica normalmente no estado suspenso com a mensagem de erro "System.ApplicationException: HTTP 401" se o fluxo está configurado para enviar e-mail(s) para um grupo do SharePoint que não permite a exibição da associações.



Mensagem de erro no interface:
RequestorId: <GUID>. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ApplicationException: HTTP 401 {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPRequestGuid":["<GUID>"],"request-id":["<GUID>"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"MicrosoftSharePointTeamServices":["15.0.0.4569"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Cache-Control":["max-age=0, private"],"Date":["Tue, 15 Oct 2014 14:24:05 GMT"],"Server":["Microsoft-IIS\/8.5"],"WWW-Authenticate":["NTLM"],"X-AspNet-Version":["4.0.30319"],"X-Powered-By":["ASP.NET"]}
Mensagem de error nos logs do SharePoint:


Exception occured in scope Microsoft.SharePoint.Utilities.SPUtility.SendEmail. Exception=System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))     at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex)     at Microsoft.SharePoint.Library.SPRequest.GetUsersDataAsSafeArray(String bstrUrl, UInt32 dwUsersScope, UInt32 dwUserCollectionFlags, String bstrValue, UInt32 dwValue, UInt32& pdwColCount, UInt32& pdwRowCount, Object& pvarDataSet)     at Microsoft.SharePoint.SPUserCollection.InitUsersCore(Boolean fCustomUsers, String[] strIdentifiers, SPUserCollectionFlags ucf)     at Microsoft.SharePoint.SPBaseCollection.GetEnumerator()     at Microsoft.SharePoint.Utilities.SPUtility.ResolveAddressesForEmail(SPWeb web, IEnumerable`1 addresses, AddressReader func)     at Microsoft.SharePoint.Utilities.SPUtility.SendEmail_Client(EmailProperties properties)     at Microsoft.SharePoint.ServerStub.Utilities.SPUtilityServerStub.InvokeStaticMethod(String methodName, ClientValueCollection xmlargs, ProxyContext proxyContext, Boolean& isVoid)     at Microsoft.SharePoint.Client.ServerStub.InvokeStaticMethodWithMonitoredScope(String methodName, ClientValueCollection args, ProxyContext proxyContext, Boolean& isVoid)


Solução: Permitir a exibição das associações para todos os usuários do SharePoint ou utilizar um outro grupo.

Fontes:

HTTP Unauthorized to /_vti_bin/client.svc/sp.utilities.utility.SendEmail

[]

SharePoint 2013 - Workflow suspenso: System.ApplicationException: HTTP 500



O fluxo de trabalho no SharePoint 2013 fica normalmente no estado suspenso com a mensagem de erro "System.ApplicationException: HTTP 500" se o fluxo está configurado para enviar e-mail(s) para um grupo do SharePoint e o email de saida não está configurado no SharePoint.

Mensagem de erro no interface:
RequestorId: <GUID>. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ApplicationException: HTTP 500 {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPClientServiceRequestDuration":["12"],"SPRequestGuid":["<GUID>"],"request-id":["<GUID>"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"MicrosoftSharePointTeamServices":["15.0.0.4569"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Cache-Control":["max-age=0, private"],"Date":[" Oct 2014 11:42:51 GMT"],"Server":["Microsoft-IIS\/8.5"],"X-AspNet-Version":["4.0.30319"],"X-Powered-By":["ASP.NET"]} at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Mensagem de error nos logs do SharePoint:


Exception occured in scope Microsoft.SharePoint.Utilities.SPUtility.SendEmail. Exception=System.Configuration.ConfigurationErrorsException: Exception of type 'System.Configuration.ConfigurationErrorsException' was thrown.     at Microsoft.SharePoint.Utilities.SPUtility.SendEmail_Client(EmailProperties properties)     at Microsoft.SharePoint.ServerStub.Utilities.SPUtilityServerStub.InvokeStaticMethod(String methodName, ClientValueCollection xmlargs, ProxyContext proxyContext, Boolean& isVoid)     at Microsoft.SharePoint.Client.ServerStub.InvokeStaticMethodWithMonitoredScope(String methodName, ClientValueCollection args, ProxyContext proxyContext, Boolean& isVoid)
Solução: Permitir a exibição das associações para todos os usuários do SharePoint ou utilizar um outro grupo.

Solução: Configurar email de saída para um farm do SharePoint 2013

Fontes:

Configure outgoing email for a SharePoint 2013 farm

[]

SharePoint 2013 - Workflow suspenso: System.ArgumentNullException: Value cannot be null.

O fluxo de trabalho no SharePoint 2013 fica normalmente no estado suspenso com a mensagem de erro "Value cannot be null." se o fluxo está configurado para enviar e-mail(s) para um grupo do SharePoint sem membros.


RequestorId: <GUID> Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ArgumentNullException: Value cannot be null. Parameter name: Input at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) 

Solução: Adicionar usuários para o grupo ou utilizar um outro grupo.

[]

terça-feira, 7 de outubro de 2014

Registrando o Workflow Manager resulta em "An error occurred while sending the request"



O evento abaixo ocorre no momento da registração do Workflow Manager devido a problemas de comunicação entre o servidor do Workflow Manager e do servidor do SharePoint:

Register-SPWorkflowService : Failed to query the OAuth S2S metadata endpoint at URI ‘http://<URL>/_layouts/15/metadata/json/1&#8242;. Error details: ‘An error occurred while sending the request.’. HTTP headers received from the server 

Nos logs do SharePoint:

Microsoft.Workflow.Client.InvalidRequestException: Failed to query the OAuth S2S metadata endpoint at URI ‘http://<URL>/_layouts/15/metadata/json/1&#8242;. Error details: ‘An error occurred while sending the request.’. HTTP headers received from the server – ActivityId: 1b2624e2-42a0-4a93-8c93-2ada0630967c. NodeId: server. Scope: /SharePoint. Client ActivityId : 487d86fd-c961-4d8c-aab2-47269989b292. —> System.Net.WebException: The remote server returned an error: (400) Bad Request 

Verifique o acesso a página http://<URL>/_layouts/15/metadata/json/1 (OAuth Endpoint) do SharePoint a partir do servidor do Workflow Manager. A mensagem no navegador deve ser a mesma - "(400) Bad Request".
A solução seria criar um registro host no servidor do Workflow Manager ou (melhor) um registro do tipo A no DNS do ambiente para o FQDN da página do SharePoint.

[]

SharePoint 2013 e OAuth - Uma visão geral


sexta-feira, 13 de junho de 2014

SharePoint 2013: Fluxos de trabalho ignoram permissões atribuídas por meio de grupos de segurança do AD


Eu observei esses dias um comportamento interessante nos fluxos de trabalho do Workflow Manager – os mesmos ignoram (aparentemente) permissões atribuídas por grupos de segurança do AD no SharePoint, que é uma pratica recomendada pela MS.

Temos as seguintes mensagens na interface:

Inglês:

HTTP 401 {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}

Português:

HTTP 401 {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"pt-BR","value":"Acesso negado.
Você não tem permissão para executar esta ação ou acessar este recurso."}}}

E os seguintes eventos foram identificados nos logs do SharePoint (Verbose):

1.       SharePoint Foundation                Claims Authentication   af32v     Verbose              Claims Windows Sign-In: Sending 401 for request <URL> because the user is not authenticated and resource requires authentication.
2.       SharePoint Foundation                Claims Authentication   af32v     Verbose              Claims Windows Sign-In: Sending 401 for request <URL>/_vti_bin/client.svc/web/lists/getbyid(guid'<GUID>')/Items?$filter=GUID+eq+<GUID> '' because the request is not from a browser.

SharePoint necessita o perfil do usuário no aplicativo de serviço “User Profile Service Application” para autenticar o usuário representado pelo fluxo de trabalho. E nesse caso especifico ser sincronizado com a OU que contém o grupo de segurança em questão.

Obs.: Você precisará sincronizar os perfis novamente se um novo usuário for adicionado ao grupo. 


terça-feira, 4 de março de 2014

WFM - Failed to query the Oauth S2S metadata endpoint: Possíveis causas do evento.

O evento "Failed to query the Oauth S2S metadata endpoint" ocorre normalmente no registro inicial do WFM (Workflow Manager), o motivo desse artigo é explicar as possíveis causas.

Causa 1 - O WFM é instalado em um servidor que faz parte do farm do SharePoint 2013. A comunicação entre SharePoint e o WFM ocorre usando HTTP.


Solução: Execute o comando Register-SPWorkflowService com o parâmetro –AllowOAuthHttp e -Force e verifique as configurações do Loopback Check, conforme artigo mencionado no final. 

Por exemplo: Register-SPWorkflowService -SPSite "http://intranet.contoso.com" -WorkflowHostUri "http://wfm.contoso.com:12291" –AllowOAuthHttp -Force

Causa 2 - O WFM é instalado em um servidor que faz parte do farm do SharePoint 2013. A comunicação entre SharePoint e o WFM ocorre usando HTTPS.


Solução: Instale os certificados do WFM conforme os seguintes passos (http://technet.microsoft.com/pt-br/library/jj658589(v=office.15).aspx) e verifique as configurações do Loopback Check conforme artigo mencionado no final.:

Para obter e exportar certificados do servidor do Gerenciador de Fluxos de Trabalho
1. Em um computador que tenha o Gerenciador de Fluxos de Trabalho instalado, selecione Gerenciador do IIS, Sites. Clique com o botão direito do mouse em Site de Gerenciamento de Fluxo de Trabalho e depois selecione Editar Ligações.
2. Selecione a porta https e depois Editar. Selecione o botão Exibir na seção Certificado SSL.
3. Para exportar um certificado do emissor, faça o seguinte:
a.) Na janela Certificado, selecione a guia Caminho de certificação.
b.) Selecione Caminho de certificação raiz e selecione Exibir.
c.) Na guia Detalhes, selecione Exportar Certificado, e escolha as opções padrão no assistente de exportação.
d.) Dê um nome amigável ao arquivo de certificado exportado.

Para instalar os certificados no SharePoint Server 2013
1. Copie o certificado do emissor o computador com o SharePoint Server 2013.
2. Adicione os certificados no repositório de certificados do Windows.
3. Para cada certificado, faça o seguinte:
a.) Clique duas vezes no arquivo para abrir e exibir o certificado.
b.) No certificado, selecione o botão Instalar Certificado para iniciar o assistente de instalação.
c.) No assistente, selecione Colocar todos os certificados no armazenamento a seguir e depois selecione Autoridades de Certificação Confiáveis.
4. Adicione os certificados no SharePoint Server indo ao Shell de Gerenciamento do SharePoint e executando o cmdlet New-SPTrustedRootAuthority. Faça isso para cada arquivo de certificado.

Por exemplo: New-SPTrustedRootAuthority -Name "Workflow Manager Farm" -Certificate c:\wfm.cer

Causa 3 - O WFM é instalado em um servidor que NÃO faz parte do farm do SharePoint 2013. A comunicação entre SharePoint e o WFM ocorre usando HTTPS.


Solução: Instale os certificados do WFM conforme a solução da causa 2.

Causa 4 - Eu percebi que algumas pessoas tentam a registrar o WFM (que é configurado para utilizar SSL na comunicação interna) no SharePoint em um web application que não é configurado para utilizar SSL sem o parâmetro –AllowOAuthHttp.


Isso não  pode funcionar, porque não faz diferença para o SharePoint se o seu farm do WFM utiliza SSL ou não, isso porque o endpoint (http://<serverfqdn>/_layouts/15/metadata/json/1) é parte do web application e não há como de se conectar a um web application usando SSL se não tem um certificado configurado e não está escutando na porta 443 (SSL).

Solução: Execute o comando Register-SPWorkflowService com o parâmetro –AllowOAuthHttp e -Force. OU configure o web application para o uso do HTTPS.

Referencias:

Workflow Manager - Failed to query the Oauth S2S metadata endpoint
SharePoint 2013 e OAuth - Uma visão geral
LoopbackCheck - O que você deveria saber
Install and configure workflow for SharePoint Server 2013
Register-SPWorkflowService

sexta-feira, 14 de fevereiro de 2014

Workflow Manager - Failed to query the Oauth S2S metadata endpoint

Eu configurei esses dias um novo ambiente para desenvolver fluxos de trabalho e encontrei um comportamento interessante. 
Observação: Eu entendo abaixo como workaround e não recomendo a seguir esses passos em um ambiente de produção.

O cenário é seguinte: Web Application configurado para utilizar http e o Workflow Manager (WFM) para não aceitar conexões http.



1. Registrando o WFM no SharePoint resulta em seguinte evento no Powershell:

Register-SPWorkflowService -SPSite "http://sp2013dev/" -WorkflowHostUri "https://sp2013dev.contoso.com:12290" -force

Register-SPWorkflowService : Failed to query the OAuth S2S metadata endpoint
at URI 'http://sp2013dev/_layouts/15/metadata/json/1'. Error details: 'The
metadata endpoint responded with an error. HTTP status code: Forbidden.'. HTTP
headers received from the server - ActivityId:
d5911e15-e529-469b-887a-24629551f543. NodeId: SP2013DEV. Scope: /SharePoint.
Client ActivityId : 3b09edcf-2fee-4ea8-98b0-699c58fba14e.
At line:1 char:1
+ Register-SPWorkflowService -SPSite "http://sp2013dev/" -WorkflowHostUri
"https:/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...WorkflowService:
   RegisterSPWorkflowService) [Register-SPWorkflowService], InvalidRequestExc
  eption
    + FullyQualifiedErrorId : Microsoft.SharePoint.WorkflowServices.PowerShell
   .RegisterSPWorkflowService

Nos logs do SharePoint o seguinte evento:

02/13/2014 05:30:41.01   PowerShell.exe (0x17E0)          0x002C       SharePoint Foundation  PowerShell  6tf2   High         Microsoft.Workflow.Client.InvalidRequestException: Failed to query the OAuth S2S metadata endpoint at URI 'http://sp2013dev/_layouts/15/metadata/json/1'. Error details: 'The metadata endpoint responded with an error. HTTP status code: Forbidden.'. HTTP headers received from the server - ActivityId: 71ac11da-2767-4d34-b9fd-0537e08c0bf0. NodeId: SP2013DEV. Scope: /SharePoint. Client ActivityId : 05cdfb77-c6c3-4526-9686-1e09bf084eee. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.     at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)     at Microsoft.Workflow.Client.HttpGetResponseAsyncResult`1.End(IAsyncResult result)     at Microsoft.Workflow.Client.ClientHelpers.SendRequest[T](HttpWebRequest request, T content)     --- End of inner exception stack trace ---     at Microsoft.Workflow.Client.ClientHelpers.SendRequest[T](HttpWebRequest request, T content)     at Microsoft.Workflow.Client.WorkflowManagementClient.SendRequest[T](HttpWebRequest request, T content)     at Microsoft.Workflow.Client.ScopeManager.PublishScopeInternal(ScopeDescription description, String[] pathSegments)     at Microsoft.SharePoint.WorkflowServices.WorkflowServerPairingContext.EnsureFarmScope(Boolean configureOAuth)     at Microsoft.SharePoint.WorkflowServices.PowerShell.RegisterSPWorkflowService.InternalProcessRecord()     at Microsoft.SharePoint.PowerShell.SPCmdlet.ProcessRecord()    05cdfb77-c6c3-4526-9686-1e09bf084eee

Todos os eventos indicaram problemas no acesso do endpoint "http://sp2013dev/_layouts/15/metadata/json/1" e realmente o acesso na pagina utilizando o navegador  resultou em 403 (forbidden).

Eu executei o mesmo comando com o parâmetro -AllowOAuthHttp com sucesso, sem problemas no endpoint, conforme abaixo:



Eu removi em seguida o Workflow Service Application com o comando Get-SPWorkflowServiceApplicationProxy | Remove-SPServiceApplicationProxy para reproduzir o problema novamente.

E desta vez consegui registar o WFM sem o parametro -AllowOAuthHttp....



PS C:\Users\administrator.CONTOSO> Get-SPWorkflowServiceApplicationProxy | Remove-SPServiceApplicationProxy

Confirm
Are you sure you want to perform this action?
Performing operation "Remove-SPServiceApplicationProxy" on Target
"WorkflowServiceApplicationProxy Name=Workflow Service Application Proxy".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):y
PS C:\Users\administrator.CONTOSO> Register-SPWorkflowService -SPSite "http://sp2013dev/" -WorkflowHostUri "https://sp2013dev.contoso.com:12290" -force
WARNING: Overwriting existing scope named "SharePoint" in the workflow server.
 If another SharePoint farm was registered using this scope, that farm may not
be able to continue working with the workflow server unless re-registered under
 another scope name.
PS C:\Users\administrator.CONTOSO>


[]



segunda-feira, 18 de novembro de 2013

Microsoft Workflow Manager - (400) Bad Request, 401.2 - Unauthorized



Os eventos abaixo ocorrem normalmente se o Workflow Manager foi reinstalado e/ou mal configurado:

1.

[...]
Microsoft.Workflow.Client.InvalidRequestException: The scope '/SharePoint/default/60b9a4e6-c9c4-46eb-b23e-fd2f63479c8d/76cb7003-0d67-4168-a4db-3698fc642d22' has no workflows under it. HTTP headers received from the server - ActivityId: d951e13a-d566-47e0-b7d4-ef6fe76d2ec0. NodeId: contoso. Scope: /SharePoint/default/60b9a4e6-c9c4-46eb-b23e-fd2f63479c8d/76cb7003-0d67-4168-a4db-3698fc642d22. Client ActivityId : a7aa559c-ffb6-6089-58d6-173f140b4e1a. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
[...]

2.

[...]
Microsoft.Workflow.Client.AuthenticationException: A response was returned that did not come from the Workflow Manager. Status code = 401:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  <html xmlns="http://www.w3.org/1999/xhtml">  <head>  <title>IIS 8.0 Detailed Error - 401.2 - Unauthorized</title>
[...]

A solução depende da causa, entretanto existem duas formas para resolver isto:

1. Re-registrar o Workflow Manager, por meio do seguinte comando:

Register-SPWorkflowService –SPSite http://intranet.contoso.com –WorkflowHostUri http://wfserver:12291 –AllowOAuthHttp -scopename SharePoint -force

2. Este script recria o escopo, altera as permissões e registra o WFM (deveria ser executado, se o evento numero 2 continua a ocorrer):

$ScopeUri = http://SERVER:12291/SharePoint
$Scope = SharePoint
$mycredentials = Get-Credential("DOMAIN\WFAPPPOOLUSER")
$SecurityConfig = New-Object Microsoft.Workflow.Client.Security.WindowsSecurityConfiguration("All Users")
$SecurityConfig.WorkflowAdminGroupName = "Users"

Get-SPWorkflowServiceApplicationProxy | Remove-SPServiceApplicationProxy
Remove-WFScope –ScopeUri $ScopeUri
Register-SPWorkflowService –SPSite "http://intranet.contoso.com" –WorkflowHostUri $ScopeUri –AllowOAuthHttp -scopename $Scope -force
Set-WFScopeSecurity -ScopeUri $ScopeUri -Credential $mycredentials -SecurityConfiguration $SecurityConfig

Register-SPWorkflowService http://technet.microsoft.com/pt-br/library/jj663115.aspx
Remove-WFScope http://msdn.microsoft.com/pt-br/library/windowsazure/jj193255(v=azure.10).aspx
Set-WFScopeSecurity http://msdn.microsoft.com/pt-br/library/windowsazure/jj193229(v=azure.10).aspx

[]


sexta-feira, 1 de novembro de 2013

A publicação de um fluxo de trabalho de aprovação (out of the box) usando o SharePoint Designer resulta em "Unexpected error associating workflow"

Acompanhado pela mensagem abaixo, os IDs variam:


(0, 0) Activity 'ID11544' validation failed: Cannot resolve Activity 'ID11528'.)
(0, 0) Activity 'ID11547' validation failed: Cannot resolve Activity 'ID11531'.)
(0, 0) Activity 'ID11520' validation failed: Cannot resolve Activity 'ID11501'.)
(0, 0) Activity 'ID11523' validation failed: Cannot resolve Activity 'ID11504'.)

Você precisará salvar o fluxo como arquivo em qualquer lugar e mudar o extensão do arquivo para .cab .

Nós precisamos extrair o arquivo workflow.xoml e renomear a extensão para xml. Você poderá abrir o arquivo com qualquer editor de texto.

Uma vez aberto procure pelo ID da atividade

Search "ID11528" (1 hit in 1 file)
 Line 446:           <ns0:AddToArrayListActivity Value="{ActivityBind ID11545,Path=ReturnValue}" x:Name="ID11544" ReturnValue="{ActivityBind ID11528,Path=ReturnValue}" />

As atividades pertencem a um passo especifico do fluxo, você deveria seguir a raiz até o inicio (para cima :), para identificar o passo do fluxo que cause o comportamento. 
No meu caso:

<ns2:OnTaskProcessCompleted Description="Quando o Processo da Tarefa For Concluído" x:Name="ID7">

Recrie o passo do fluxo identificado no SharePoint Designer utilizando as mesmas configurações/atividades e publica ele no SharePoint.

[]