public void RemoveCredentials(BitsCredentials credentials) { try { if (job2 != null) // only supported from IBackgroundCopyJob2 and above { job2.RemoveCredentials((BG_AUTH_TARGET)credentials.AuthenticationTarget, (BG_AUTH_SCHEME)credentials.AuthenticationScheme); } } catch (COMException exception) { manager.PublishException(this, exception); } }
public void AddCredentials(BitsCredentials credentials) { try { if (job2 != null) // only supported from IBackgroundCopyJob2 and above { BG_AUTH_CREDENTIALS bgCredentials = new BG_AUTH_CREDENTIALS(); bgCredentials.Scheme = (BG_AUTH_SCHEME)credentials.AuthenticationScheme; bgCredentials.Target = (BG_AUTH_TARGET)credentials.AuthenticationTarget; bgCredentials.Credentials.Basic.Password = credentials.Password.ToString(); bgCredentials.Credentials.Basic.UserName = credentials.UserName.ToString(); job2.SetCredentials(ref bgCredentials); } } catch (COMException exception) { manager.PublishException(this, exception); } }